Как разместить одинаковые кнопки в верхней части каждого занятия? - PullRequest
0 голосов
/ 01 января 2019

Я хочу разместить 5 кнопок в верхней части каждого действия, и я хочу перемещаться по действиям, используя эти 5 кнопок (вы знаете, как на главном экране WhatsApp), и они также должны прокручиваться по горизонтали.Я хочу, чтобы они были доступны на каждом мероприятии.Кто-нибудь, пожалуйста, подскажите, как это сделать?

1 Ответ

0 голосов
/ 01 января 2019

Попробуйте это

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

        <TabHost
            android:id="@+id/tabHost"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"></TabWidget>

                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <LinearLayout
                        android:id="@+id/tab1"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#ffc916"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="This is tab 1" />

                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/tab2"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#da8200"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="This is tab 2" />
                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/tab3"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#5b89ff"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="This is tab 3" />
                    </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab3"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#5b89ff"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:text="This is tab 4" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab3"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#5b89ff"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:text="This is tab 5" />
                </LinearLayout>
                </FrameLayout>
            </LinearLayout>
        </TabHost>

    </LinearLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...