How do I remove the selected tab indicator from the TabWidget?

后端 未结 17 1255
猫巷女王i
猫巷女王i 2020-12-09 02:19

Here\'s what I\'d like to remove :

\"enter

How do I replace the indicator show

相关标签:
17条回答
  • 2020-12-09 02:46

    I have yet another hack.

        TabLayout tabLayout = (TabLayout) fragmentView.findViewById(R.id.tabs);
        tabLayout.setSelectedTabIndicatorHeight(0);
    

    It's basically the same idea as Eleojasmil's.

    0 讨论(0)
  • 2020-12-09 02:49

    Try setting the Tab indicator height to zero:

    tabLayout.setSelectedTabIndicatorHeight(0);
    
    0 讨论(0)
  • 2020-12-09 02:49

    Use

        tabLayout.setSelectedTabIndicator(null);
    

    This will set the selected indicator drawable to null.

    0 讨论(0)
  • 2020-12-09 02:50

    This line app:tabIndicatorHeight="0dp" solve the problem for me in xml

     <android.support.design.widget.TabLayout
            android:id="@+id/view_bottom_tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabIndicatorHeight="0dp"             //this line
            app:tabGravity="fill"
            app:tabMode="fixed" />
    
    0 讨论(0)
  • 2020-12-09 02:50

    Use tabLayout.setSelectedTabIndicator(0).

    tabLayout.setSelectedTabIndicatorHeight(0) is now deprecated and tabLayout.setSelectedTabIndicatorColor(Color.TRANSPARENT) won't perform as well because it uses transparency.

    0 讨论(0)
  • 2020-12-09 02:50

    For the best setting app:tabIndicatorHeight="0dp" worked for me.

    0 讨论(0)
提交回复
热议问题