J'ai fait un tel TabPageIndicator, comment puis-je supprimer la petite ligne. Utilisé viewpagerindicator
Réponses:
0 pour la réponse № 1Vous devriez utiliser des bibliothèques de support Android pour Onglets au lieu d'une bibliothèque tierce.
activity_main.xml
<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:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
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: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>
Dans le code, vous pouvez configurer des onglets dans une ligne de code
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
Et définissez ensuite la hauteur de l'indicateur d'onglet sur 0 et la couleur sur tablayoutcolor pour les faire disparaître
TabLayout.setSelectedTabIndicatorHeight(int height)
Pour la couleur:
TabLayout.setSelectedTabIndicatorColor(int color)
Vous pouvez trouver un exemple complet ici et fil relatif à la couleur de l'onglet ici