如何在Android中实现垂直标签页布局?

时间:2019-10-11 17:33:34

标签: android android-layout kotlin material-design

我正在尝试在平板电脑上运行的应用程序中实现垂直标签页布局。我试图将TabLayout的方向设置为垂直,但没有运气。

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">



    <com.google.android.material.tabs.TabLayout
        android:id="@+id/staff_menu_tabs"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:orientation="vertical"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.tabs.TabItem
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="Tab 1"/>
        <com.google.android.material.tabs.TabItem
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="Tab 2"/>
        <com.google.android.material.tabs.TabItem
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="Tab 3"
           />

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


</androidx.constraintlayout.widget.ConstraintLayout>

enter image description here

0 个答案:

没有答案