Hello,

When implementing tabs I use TabHost . It creates something like a ribbon with tab headers ( TabWidget ).

In my application, tabs can be switched either by clicking on the tab headers in this feed or by flipping tabs.

In the second variant (turning over), turning over creates such a situation (there are a lot of tabs and all their titles do not fit into the screen) that the tab is displayed on the screen and its title is in the ribbon behind the screen.

How can I move the ribbon with headings ( tabWidgets ) so that the title of the displayed tab is always on the screen, and not behind the screen?

Thank you all for your help.

Found the answer to your question in the English version of the site . The first answer to the question helped solve my problem. Thank you comrade @Vania Diezel.

    1 answer 1

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabSelectedTextColor="@color/bg_color" app:tabIndicatorColor="@color/bg_color" app:tabTextAppearance="@style/TextAppearance.Design.Tab" *app:tabMode="fixed" app:tabGravity="fill"*/> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.design.widget.CoordinatorLayout> 
    • thanks for the answer. It is possible for more details on where to add it. - foxis
    • @foxis updated the answer - iFr0z
    • thank you for the details. Only it is desirable for me to use TabHost as tabs, since I have an application ready and I don’t want to redo the whole application for new tab widgets. - foxis
    • @foxis eh, I knew that)) well, at least you can drill google based on this tabmod for the old version. And so, I advise you to switch to a new format, it is more flexible, and indeed when the thread still has to be :) - iFr0z
    • Yes, I already understood, TabHost is not the best solution for tabs. I will try to look for more, as a last resort it is necessary to rewrite the code for a new widget. - foxis