Viewpager with circle and title indicator

浪尽此生 提交于 2020-01-06 08:26:20

问题


I'm using Viewpager and the Circle and Title view pager from JakeWharton The viewpager with the circle indicator is working fine, but while using the view pager with both circle and title indicator both indicators are not working. Here is a screenshow of the issue:

So is it possible to use both indicators at the same time, and if so how can I do that? Also does anyone knows how can I style the title indicator? Right now it shows a blue line and no text..

Here is my code:

adapter = new ContractsPagerAdapter(getActivity(), topContracts, selected);     
        pager.setAdapter(adapter);
        indicator.setViewPager(pager);
        titleIndicator.setTextColor(getResources().getColor(R.color.white));
        titleIndicator.setViewPager(pager);

回答1:


Hi you can do it logically. I have implemented it using ViewPager and frame layout. Frame layout to show the indictor. Indicator is basically two image for off and on. You can download the complete code and change accordingly. http://javaant.com/viewpager-with-circle-indicator-in-android/#.VpdtjMB943g Hope this will help you.




回答2:


I can only offer an alternative library. I am currently using this Material Design Library which has a ViewPagerWithIndicator activity layout. It uses fragments and right off the bat does exactly what you're asking. It changes the ActionBarTitle along with the indicator. It is very easy to implement and lightweight.



来源:https://stackoverflow.com/questions/32829376/viewpager-with-circle-and-title-indicator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!