How To Detect A Click On Every Single Tab In Tablayout?
I have a viewpager with undetermined pages, because the user can add pages too. Thats okay, but I have no idea how to make it possible, that my user could delete those pages. I hav
Solution 1:
Implementation of LongClick
listener to each TAB
:
LinearLayouttabStrip= (LinearLayout) tabLayout.getChildAt(0);
for (inti=0; i < tabStrip.getChildCount(); i++) {
// Set LongClick listener to each Tab
tabStrip.getChildAt(i).setOnLongClickListener(newView.OnLongClickListener() {
@OverridepublicbooleanonLongClick(View v) {
Toast.makeText(getApplicationContext(), "Tab clicked" , Toast.LENGTH_SHORT).show();
returntrue;
}
});
}
Hope this will help~
Post a Comment for "How To Detect A Click On Every Single Tab In Tablayout?"