Last active
December 17, 2020 13:15
-
-
Save Kalaiz/b7a9337df5a6d7dfccd0ef94d4fd2e89 to your computer and use it in GitHub Desktop.
Simple Tab Layout XML Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<--https://stackoverflow.com/questions/65078252/custom-tab-layout-with-viewpager2/65079234#65079234 --> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<com.google.android.material.tabs.TabLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/colorAccent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent"> | |
<com.google.android.material.tabs.TabItem | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:text="Tab 1" /> | |
<com.google.android.material.tabs.TabItem | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:text="Tab 2" /> | |
<com.google.android.material.tabs.TabItem | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:text="Tab 3" /> | |
</com.google.android.material.tabs.TabLayout> | |
</androidx.constraintlayout.widget.ConstraintLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment