1

I´m currently working on adding a tablayout to my XML but I can´t figure out how to remove the tooltip when doing a longpress on the tab. Does anyone know? Here´s an image of what it looks like https://i.stack.imgur.com/8dnRe.jpg . It´s a WIP so it looks weird now

Here´s the tablayout

    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tl_crypto_detail"
        android:layout_width="match_parent"
        app:layout_constraintTop_toBottomOf="@id/topSeparator"
        android:layout_marginHorizontal="15dp"
        android:tooltipText=""
        app:tabIndicatorColor="#FFFFFF"
        app:tabTextColor="#FFFFFF"
        android:layout_height="wrap_content"/>
a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
  • If you meant to remove the underline, pls follow this question: https://stackoverflow.com/questions/34388841/remove-the-selector-line-under-current-tab-for-a-tablayout – ritesh4302 Jul 20 '21 at 12:42
  • Not the underline but if you do a long press on a tab, it pops up a little view (tooltip) like you can see in the imgur link. I don´t want that view to show up – Oscar Berggren Jul 21 '21 at 08:23

1 Answers1

1

You could do it manually, by setting the TooltipText to null for every tab.

Kotlin:

for (i in 0 until tabLayout.tabCount) {
    tabLayout.getTabAt(i)?.view?.let { tabView ->
        TooltipCompat.setTooltipText(tabView, null)
    }
}

Java:

for (int i = 0; i < tatabLayoutbs.getTabCount(); i++) {
    if (tabLayout.getTabAt(i) != null) {
       TooltipCompat.setTooltipText(tabLayout.getTabAt(i).view, null);
    }
}