1.加入依赖在build.gradle
dependencies {
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
2.在layout里加入PagerSlidingTabStrip控件,它通常要在ViewPager控件之中
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip" />
详细介绍各种属性的用法,让你的app与众不同
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 每个标签的分割线的颜色pstsIndicatorHeight
Height 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 tabpstsTabBackground
Background drawable of each tab, should be a StateListDrawable 每个标签的背景,应该是一个StateListDrawablepstsShouldExpand
If set to true, each tab is given the same weight, default false 如果设置为true,每个标签是相同的控件,均匀平分整个屏幕,默认是falsepstsTextAllCaps
If true, all tab titles will be upper case, default true 如果为true,所有标签都是大写字母,默认为true
所有的属性都有他们自己的getter和setter方法来随时改变他们.