Как разместить кнопку под ImageView в TableRow - PullRequest
0 голосов
/ 01 апреля 2020

Привет, ребята, поэтому у меня есть это:

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

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_weight="1" >

                <ImageView
                    android:id="@+id/imageView2"
                    android:layout_width="119dp"
                    android:layout_height="83dp"
                    android:layout_weight="0"
                    app:srcCompat="@drawable/icon" />

                <Button
                    android:id="@+id/button1"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:layout_below="@id/imageView" // This is the solution I found which doesn't seems to work on tablerow
                    android:text="cccccccccccccccccccccccccccc" />

                <Button
                    android:id="@+id/button2"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:text="Button" />

            </TableRow>

            <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_weight="1" >

                <Button
                    android:id="@+id/button3"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:text="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" />

                <Button
                    android:id="@+id/button4"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:text="ddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" />
            </TableRow>

        </LinearLayout>

Я хотел кнопку под ImageView, но функция "android: layout_below =" @ id / imageView "не работает в TableRow. Вот как это выглядит сейчас: enter image description here

Поэтому я хотел, чтобы это изображение было над кнопкой "CCCCCCC", но мне не удается заставить его работать

...