AndroidX TabLayout setupWithViewPager() not found

from the CommonsWare Community archives

At January 16, 2020, 10:40pm, arpit999 asked:

I am creating Tabs in my activity but using AndroidX. Not able to find setupWithViewPager() method.

How should I implement this method or is there any alternative method to setup viewpager?

here is my gradle

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
}

At January 16, 2020, 11:08pm, mmurphy replied:

There is no TabLayout in AndroidX. There is one in the older Android Support Library, and there is one in the Material Components for Android library.

You should not be able to find TabLayout either, with that set of dependencies.


At February 5, 2020, 9:09pm, arpit999 replied:

Sorry for the late reply but how should I achieve same result using the androidx library? Thanks


At February 5, 2020, 10:53pm, mmurphy replied:

There is no TabLayout in AndroidX, so I cannot answer your question.