Search code examples
androidandroid-layoutandroid-support-libraryandroid-tablayout

Alternative for deprecated TabLayout


I was using a set of regular buttons to change the property a discrete seek bar modifies the value of. Touching one of the buttons would change the value a property, whose setter will then change the min/max of the seekbar. This property is also used in onProgressChanged of the seek bar to determine which property to change the value of.

I wanted some kind of indicator that would move with an animation between those buttons. I found TabLayout which provides this functionality.

The only issue is that it is a part of the deprecated Support Library. Its reference page points to AndroidX, in which I could not find a valid replacement.

Is there a good alternative to TabLayout, or should I just continue using it?


Solution

  • Now you need to use com.google.android.material.tabs.TabLayout

    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    

    For more information please check Tab Layout