把github上的PagerSlidingTabStrip稍作修改:

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

栗子:javascript:void(0)

PagerSlidingTabStrip 自定义属性列表:

pstsIndicatorColorpstsUnderlineColorpstsDividerColorpstsIndicatorHeight

  • Height of the sliding indicator

pstsUnderlineHeightpstsDividerPaddingpstsTabPaddingLeftRightpstsScrollOffsetpstsTabBackgroundpstsShouldExpandpstsTextAllCaps

修改后加了一个属性 selectedTabTextColor

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

下图效果的代码:

[html] 

1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
2. xmlns:tools="http://schemas.android.com/tools"  
3. android:layout_width="match_parent"  
4. android:layout_height="match_parent"   
5. xmlns:app="http://schemas.android.com/apk/res/org.lmw.demo.slidingtab">  
6.   
7. <org.lmw.demo.slidingtab.widget.PagerSlidingTabStrip  
8. android:id="@+id/tabs"  
9. android:layout_width="match_parent"  
10. android:layout_height="40dp"  
11. app:pstsShouldExpand="true"  
12. app:pstsUnderlineHeight="2dp"  
13. app:pstsIndicatorHeight="2dp"  
14. app:pstsIndicatorColor="@android:color/holo_blue_light"  
15. app:selectedTabTextColor="@android:color/holo_blue_light"  
16. app:pstsDividerColor="@android:color/transparent"  
17. app:pstsTabBackground="@drawable/background_tab"  
18. android:background="@android:color/white"  
19. />  
20.   
21. <android.support.v4.view.ViewPager  
22. android:id="@+id/pager"  
23. android:layout_width="match_parent"  
24. android:layout_height="wrap_content"  
25. android:layout_below="@+id/tabs" />  
26.   
27. </RelativeLayout>



Android滑动页面导航效果: PagerSlidingTabStrip_ide