I imagine someone has had this question before, I just don't quite know what the right keywords are to find the answer? I am making an android app with an activity that includes tabs using TabLayout. Nothing fancy, just really standard stuff. In fact, so far I've done literally nothing but make a completely new application with a single tabbed activity using the auto-generated code from Android Studio. Everything works fine, but there is one feature I cannot figure out how to turn off -- when I long click on any tab, a little rectangular alt text or something with the title of the tab pops up on screen just above the tab. It's not the end of the world if I can't eliminate it, I just find it to be irritating and incompatible with the overall desired feel of my app given that it's literally just duplicating the tab title. I can't find any code that is causing this to appear, so I don't know how to delete it. The picture below shows what I'm talking about circled in red.
If anyone needs me to post code to help answer, I can... but you can also just make a new tabbed activity in a throwaway application in Android Studio and get exactly the same boilerplate code I have.
Edit: I added the term "tooltip" to the title so others can find the relevant thread more easily if they have the same problem.
Kudos to Mike M. for the answer, shown in comments above. I implemented it successfully, so if anyone comes back here looking for the answer, here's the successful java code, which is placed in the onCreate() method of the activity containing the tabLayout:
// turn off that tooltip text thing immediately on activity creation
for (int i=0; i<tabs.getTabCount(); i++) {
TooltipCompat.setTooltipText(Objects.requireNonNull(tabs.getTabAt(i)).view, null);
}
tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
int tabPosition = tab.getPosition(); // syntactic sugar
viewPager2.setCurrentItem(tabPosition, true);
// Repeat of the code above -- tooltips reset themselves after any tab relayout, so I
// have to constantly keep turning them off again.
for (int i=0; i<tabs.getTabCount(); i++) {
TooltipCompat.setTooltipText(Objects.requireNonNull(tabs.getTabAt(i)).view, null);
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});