25.TabLayout的使用

来源:互联网 发布:建筑方案设计软件 编辑:程序博客网 时间:2024/05/20 19:30

转载请注明出处 http://blog.csdn.net/qq_31715429/article/details/50979064
本文出自:猴菇先生的博客

    在2015年的google大会上,google发布了新的Android Support Design库,里面包含了几个新的控件,其中就有一个TabLayout,它就可以完成TabPageIndicator的效果,而且还是官方的,最好的是它可以兼容到2.2以上版本,包括2.2。下面我就举一个简单的例子来使用它。    我使用的 android studio进行开发的,所以引用TabLayout很简单,只要在build.gradle中加入compile 'com.android.support:design:22.2.0'即可。
<android.support.design.widget.TabLayout      android:id="@+id/tab_FindFragment_title"      android:layout_width="match_parent"      android:layout_height="wrap_content"      android:background="@color/titleBlue"      app:tabIndicatorColor="@color/white"  // 下方滚动的下划线颜色      app:tabSelectedTextColor="@color/gray"// tab被选中后,文字的颜色      app:tabTextColor="@color/white"  />   // tab默认的文字颜色  

详见:https://segmentfault.com/a/1190000003500271

0 0