Skip to content Skip to sidebar Skip to footer

Tablayout Title Aren't Visible In Android

As the title explain, I am not able to see the title in the tablayout. I have followed a tutorial on youtube to create this swipable tabs. Here the link of the tutorial I have fol

Solution 1:

In your activity_main.xml, add this line to your ViewPager :

<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/viewpager"app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior">
</android.support.v4.view.ViewPager>

The reason for that is since you use a Coordinator layout, you need to provide which view it should react to. In this case, your ViewPager

EDIT : It also seems that your Adapter doesn't implement the required function for titles :

    @Override
    public CharSequence getPageTitle(int position) {
        return tabTitles.get(position);
    }

Post a Comment for "Tablayout Title Aren't Visible In Android"