前段时间在谷歌电子市场里学到的是PagerTabStrip,今天在这个项目里用的是TabPageIndicator,现在也来介绍一下它的使用。
(1)把ViewPagerIndicator开源项目引入工作空间(注意supportV4包一定要和自己项目的V4包保持一致!如果不一致尽管可能不会报错,但运行的时候是会挂掉的!)
(2)给自己的项目引入那个类库
(3)在xml布局文件里,在viewPager之上添加:
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
(4)java代码中:
public TabPageIndicator mIndicator;
mIndicator = (TabPageIndicator) v.findViewById(R.id.indicator);
//vpDetailMenuNews.setO