Android滑动页面导航效果: PagerSlidingTabStrip
16lz
2021-01-24
把github上的PagerSlidingTabStrip稍作修改:
tab的文字颜色选中变色(原版文字不变色),类似微信导航
栗子:http://download.csdn.net/detail/onlyonecoder/7722021
PagerSlidingTabStrip 自定义属性列表:
pstsIndicatorColor
Color of the sliding indicatorpstsUnderlineColor
Color of the full-width line on the bottom of the viewpstsDividerColor
Color of the dividers between tabspstsIndicatorHeight
Height of the sliding indicatorpstsUnderlineHeight
Height of the full-width line on the bottom of the viewpstsDividerPadding
Top and bottom padding of the dividerspstsTabPaddingLeftRight
Left and right padding of each tabpstsScrollOffset
Scroll offset of the selected tabpstsTabBackground
Background drawable of each tab, should be a StateListDrawablepstsShouldExpand
If set to true, each tab is given the same weight, default falsepstsTextAllCaps
If true, all tab titles will be upper case, default true
如果不设置 默认和滑动指示器颜色(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>
更多相关文章
- LinearLayout和RelativeLayout的属性差异
- 关于com.actionbarsherlock.widget.SearchView的使用无法调用Sea
- Android(安卓)自定义View实现波浪动画
- Android(安卓)的系统属性(SystemProperties)设置分析
- No label views point to this text field with an android:labe
- android popwindow仿微信右上角弹出框,dialog底部显示
- android按钮事件触发拨号器
- ListView滚动小滑块
- (转)Android(安卓)TextView背景色、圆角、内部填充设置