0

I'm using ViewPager and TabLayout to show tabs of fragments pages. What i want now is to set divider with color in between between tabs

Below is my XML code

<com.google.android.material.tabs.TabLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tab_layout"
        app:tabSelectedTextColor="#ffffff"
        app:tabMode="scrollable"
        app:tabGravity="center"
        app:tabTextColor="#000000"
        app:tabBackground="@drawable/pager"
        app:tabIndicatorColor="#f10606"
        app:tabIndicatorHeight="7dp">

    </com.google.android.material.tabs.TabLayout>

    <!-- Tab divider -->
    <View
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:background="@android:color/black" />

    <androidx.viewpager.widget.ViewPager
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contextClickable="true"
        android:id="@+id/view_pager"
        android:layout_marginBottom="70dp"
        android:layout_below="@+id/tab_layout"
        app:tabMode="fixed"
        app:tabGravity="fill">

    </androidx.viewpager.widget.ViewPager>


 
</RelativeLayout>
Joseph
  • 400
  • 4
  • 19

0 Answers0