1.建立Tab的简单例子:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:layout_width="80px" android:layout_height="wrap_content"
android:id="@+id/home" android:background="@drawable/tab_one_normal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/home"
android:background="@drawable/home" style="@style/SpecialText" />
</LinearLayout>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/line" />
<LinearLayout android:orientation="vertical"
android:layout_width="80px" android:layout_height="wrap_content"
android:background="@drawable/tab_one_normal" android:id="@+id/publish">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/publish"
style="@style/SpecialText" android:background="@drawable/publish" />
</LinearLayout>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/line" />
<LinearLayout android:orientation="vertical"
android:layout_width="80px" android:id="@+id/change"
android:layout_height="wrap_content" android:background="@drawable/tab_one_normal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/change"
style="@style/SpecialText" android:background="@drawable/change" />
</LinearLayout>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/line" />
<LinearLayout android:orientation="vertical"
android:layout_width="80px" android:id="@+id/more"
android:layout_height="wrap_content" android:background="@drawable/tab_one_normal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/more"
style="@style/SpecialText" android:background="@drawable/more" />
</LinearLayout>
</LinearLayout>
2.java代码段:
linearLayout = (LinearLayout) findViewById(R.id.home);
linearLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
linearLayout
.setBackgroundResource(R.drawable.tab_two_highlight);
publish.setBackgroundResource(R.drawable.tab_one_normal);
change.setBackgroundResource(R.drawable.tab_one_normal);
more.setBackgroundResource(R.drawable.tab_one_normal);
}
});
3.另外附上部分图片资源,个人觉得做Tab只要资源有就可以做的很好
分享到:
相关推荐
微信小程序底部tab-bar组件,高度还原微信原生tabBar功能及样式,且兼容iPhone异形全面屏,主要用于解决微信官方tabBar在遮罩层下无法被遮住的问题
类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab切换效果类似微信底部tab...
底部tab,并且自适应各种屏幕 底部tab,并且自适应各种屏幕 底部tab,并且自适应各种屏幕 底部tab,并且自适应各种屏幕
微信小程序练习demo:底部3个tab实现选中时文字和图片改变(源代码+截图)微信小程序练习demo:底部3个tab实现选中时文字和图片改变(源代码+截图)微信小程序练习demo:底部3个tab实现选中时文字和图片改变(源代码+截图...
Android中底部tab,中间凸起按钮的效果
APP底部TAB图标设计原稿,PNG图标,高清晰!
这是一个TAB的例子,可以学习一下不同TAB标签点击后界面的切换。。。。。。。。。。。。。。。。。。。。。。
React-Native实现App底部tab切换,项目的引导页,点击“启动应用”,跳转到APP主页,主页底部的五个tab的实现
点击TabHost的tab页,切换后更换tab背景颜色
android的tab例子,动态tab例子
Android 自定义底部TAB Android 自定义底部TAB Android 自定义底部TAB
android手机开发中tab控件的一个简单的运用例子
博客地址 http://blog.csdn.net/sbsujjbcy/article/details/46808177
点击底部菜单 tab滑出效果 动画 底部菜单
微信小程序 下拉刷新,tab切换 (源码)微信小程序 下拉刷新,tab切换 (源码)微信小程序 下拉刷新,tab切换 (源码)微信小程序 下拉刷新,tab切换 (源码)微信小程序 下拉刷新,tab切换 (源码)微信小程序 下拉刷新,tab...
安卓底部 tab 切换案例 仅用于学习用,下载后请在24小时内删除。
实现微信小程序中顶部tab页点击切换,下面显示不同列表
仿微信例子,使用TabHost实现底部tab,可以显示未读信息条数。适合初学者学习研究。
自定义实现底部导航栏(底部Tab)和Android 底部导航栏中间凸起