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() {@Overridepublic 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只要资源有就可以做的很好

更多相关文章

  1. java.lang.IllegalStateException Fragment already added: Home
  2. Android(安卓)8/9高通平台客制化虚拟导航按键隐藏
  3. Android(安卓)针对View的截图操作
  4. Android(安卓)数据库升级 数据迁移 数据不丢失
  5. 蓝牙最简单的例子,最难得的简单
  6. layui 上传图片 移动端 调用相机
  7. android 代码控制LinearLayout 宽度高度 报错widget.LinearLayou
  8. android 在Resources 中定义arrays
  9. Android(安卓)WebView 加载富文本内容

随机推荐

  1. Android使用Application总结
  2. 浅谈Android中的 Fragment、生命周期回调
  3. android事件拦截处理机制详解
  4. Android(安卓)公共库的建立方法
  5. Android(安卓)开发之 Shape 篇
  6. Android命令Monkey压力测试,详解
  7. Android模拟器环境中安装和删除应用程序
  8. Android(安卓)opengl es创建动画详解
  9. Android(安卓)应用 Application 用法 ;
  10. 通过ant脚本,编译打包android工程