Android TabLayout for Sliding Tabs | Generated by AI

Home 2025.11

The correct answer is A. TabLayout.

Explanation:
In Android development (especially with the AndroidX libraries), TabLayout is the class specifically designed to create sliding tab interfaces that work seamlessly with ViewPager or ViewPager2.

Typical setup:

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

<androidx.viewpager.widget.ViewPager
    android:id="@+id/viewPager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
TabLayout tabLayout = findViewById(R.id.tabLayout);
ViewPager viewPager = findViewById(R.id.viewPager);
viewPager.setAdapter(myAdapter);
tabLayout.setupWithViewPager(viewPager);  // This links them for sliding behavior

The other options:

So, definitively: A. TabLayout


Back

x-ai/grok-4.1-fast

Donate