Android滑动页面导航效果: PagerSlidingTabStrip


广告时间:张大妈  好看美剧  妹子图 


把github上的PagerSlidingTabStrip稍作修改:

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


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


PagerSlidingTabStrip 自定义属性列表:

  • pstsIndicatorColor Color of the sliding indicator
  • pstsUnderlineColor Color of the full-width line on the bottom of the view
  • pstsDividerColor Color of the dividers between tabs
  • pstsIndicatorHeightHeight of the sliding indicator
  • pstsUnderlineHeight Height of the full-width line on the bottom of the view
  • pstsDividerPadding Top and bottom padding of the dividers
  • pstsTabPaddingLeftRight Left and right padding of each tab
  • pstsScrollOffset Scroll offset of the selected tab
  • pstsTabBackground Background drawable of each tab, should be a StateListDrawable
  • pstsShouldExpand If set to true, each tab is given the same weight, default false
  • pstsTextAllCaps If 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>




  • 15
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 14
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值