把github上的PagerSlidingTabStrip稍作修改:

tab的文字颜色选中变色(原版文字不变色),类似微信导航


栗子:http://download.csdn.net/detail/onlyonecoder/7722021


PagerSlidingTabStrip 自定义属性列表:

  • pstsIndicatorColorColor of the sliding indicator
  • pstsUnderlineColorColor of the full-width line on the bottom of the view
  • pstsDividerColorColor of the dividers between tabs
  • pstsIndicatorHeightHeight of the sliding indicator
  • pstsUnderlineHeightHeight of the full-width line on the bottom of the view
  • pstsDividerPaddingTop and bottom padding of the dividers
  • pstsTabPaddingLeftRightLeft and right padding of each tab
  • pstsScrollOffsetScroll offset of the selected tab
  • pstsTabBackgroundBackground drawable of each tab, should be a StateListDrawable
  • pstsShouldExpandIf set to true, each tab is given the same weight, default false
  • pstsTextAllCapsIf true, all tab titles will be upper case, default true
修改后加了一个属性 selectedTabTextColor

如果不设置 默认和滑动指示器颜色(pstsIndicatorColor)一致


下图效果的代码:


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"     xmlns:app="http://schemas.android.com/apk/res/org.lmw.demo.slidingtab">    <org.lmw.demo.slidingtab.widget.PagerSlidingTabStrip        android:id="@+id/tabs"        android:layout_width="match_parent"        android:layout_height="40dp"        app:pstsShouldExpand="true"        app:pstsUnderlineHeight="2dp"        app:pstsIndicatorHeight="2dp"        app:pstsIndicatorColor="@android:color/holo_blue_light"       app:selectedTabTextColor="@android:color/holo_blue_light"        app:pstsDividerColor="@android:color/transparent"    app:pstsTabBackground="@drawable/background_tab"   android:background="@android:color/white"         />    <android.support.v4.view.ViewPager        android:id="@+id/pager"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_below="@+id/tabs" /></RelativeLayout>




更多相关文章

  1. LinearLayout和RelativeLayout的属性差异
  2. 关于com.actionbarsherlock.widget.SearchView的使用无法调用Sea
  3. Android(安卓)自定义View实现波浪动画
  4. Android(安卓)的系统属性(SystemProperties)设置分析
  5. No label views point to this text field with an android:labe
  6. android popwindow仿微信右上角弹出框,dialog底部显示
  7. android按钮事件触发拨号器
  8. ListView滚动小滑块
  9. (转)Android(安卓)TextView背景色、圆角、内部填充设置

随机推荐

  1. 从删库到跑路,DBA 如何防止被淘汰?
  2. 系统监控工具-dstat
  3. 【MySQL】Linux下MySQL 5.5、5.6和5.7的R
  4. 【故障|监听】TNS-12545、TNS-12560、TNS
  5. 如何在MySQL中查询OS线程id(LWP)?
  6. Longest Substring Without Repeating Ch
  7. Oracle 12c数据库优化器统计信息收集的最
  8. zabbix中配置当memory剩余不足20%时触发
  9. Navicat 提示Cannot create oci environm
  10. coe_xfr_sql_profile.sql和coe_load_sql_