1.在布局文件中加入
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator_top"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
2.在activity中注册style
android:theme="@style/Theme.PageIndicatorDefaults"
3.改style配置文件
Widget.TabPageIndicator:
vpi__tab_indicator是线条样式的选择器
然后以此为蓝本写一个字体的选择器
4.在源代码中加入反拦截代码
/**
* 请求父类以上不拦截滑动事件
*/
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
getParent().requestDisallowInterceptTouchEvent(true);
return super.dispatchTouchEvent(ev);
}