astuetz / PagerSlidingTabStrip

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

PagerSlidingTabStrip Click #168

Open selmanon opened 9 years ago

selmanon commented 9 years ago

How to trigger the click event on PagerSlidingTabStrip ?

the bellow code isn't triggred :

tabs.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.v("PagerSlidingTabStrip Click", "PagerSlidingTabStrip Click");
        }
});
bryanoltman commented 9 years ago

Just saw this while trying to fix the same problem and found a solution here: http://stackoverflow.com/questions/27649629/how-to-use-both-pagerslidingtabstrip-tabs-and-drawerlayout-slidingmenu/27887478#27887478

ericlw commented 9 years ago

My solution to this was to send a broadcast from within the library itself. Each tab has an onClick function in the private "addTab" class. Your fragment in the viewpager can listen for it's respective broadcast in a BroadcastReceiver