Highlight or underline selected TabPageIndicator

前端 未结 2 553
余生分开走
余生分开走 2021-02-13 10:25

I have a dualpane on a tablet-sized landscape layout and I\'m using fragments.

On the left I have a fragment with a listview. When a click occurs on one of the item lis

2条回答
  •  佛祖请我去吃肉
    2021-02-13 10:52

    Just use two library 1) Sherlock action bar 2) ViewPageIndicator and implement tabPageIndicator view it will it provides you default tab and for highliget tab provide underline. IF you want to change underline color than you need to change drawable 9th patch images which used in underlinbe.

    Here is sample code

    XML view sample

                   
    
            
    
            
        
    
    

    Fragment Code

            final FragmentPagerAdapter adapter = new  FragmentChildPageAdapter(getChildFragmentManager());//getActivity().getSupportFragmentManager()
    
        final ViewPager pager = (ViewPager) v.findViewById(R.id.pager);
        pager.setAdapter(adapter);
    
        final TabPageIndicator indicator = (TabPageIndicator) v.findViewById(R.id.indicator);
        indicator.setViewPager(pager);
    

提交回复
热议问题