astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

Icon of action bar #211

Open Fakher-Hakim opened 9 years ago

Fakher-Hakim commented 9 years ago

Hello Please how can i change the icone in the action bar ?? Thanks :)

Daan-Hoogland commented 9 years ago

Use your own adapter that implements PagerSlidingTabStrip.IconTabProvider

Load any icons you need in an array, make sure you set the array index equal to the tab index, example:

    final int[] ICONS = new int[]{
            R.drawable.tab_1,
            R.drawable.tab_2,
            R.drawable.tab_3,
            R.drawable.tab_4,
    };

Then you still have to override the super method to assign the icons like so:

    @Override
    public int getPageIconResId(int position) {
        return ICONS[position];
    }

Full implementation here