[JAVA] Füllen Sie den Bildschirm mit Schaltflächen in TableLayout

Ich möchte die Breite vergrößern, um den Bildschirm auszufüllen

↓ Ich möchte diese Schaltfläche auf die volle Breite erweitern. table1.PNG

Originalcode

activity_main.xml


<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Button" />

        <Button
            android:id="@+id/button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Button" />
    </TableRow>

    <TableRow
        android:layout_width="0dp"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/button4"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Button" />

        <Button
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Button" />
    </TableRow>
</TableLayout>

stretchColumns android: stripColumns = "Spaltennummer" ist gesetzt.

activity_main.xml


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="0,1">

table6.PNG Es verbreitete sich wunderschön.

Ich möchte die Breite in den Bildschirm einpassen

Diesmal, wenn sich die Schaltfläche über die Bildschirmbreite hinaus erstreckt.

table2.PNG

shrinkColumns android: shrinkColumns = "Spaltennummer" ist gesetzt.

activity_main.xml


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:shrinkColumns="0,1,2,3,4">

table3.PNG Es passt.

Ich möchte die vertikale Breite erweitern, um den Bildschirm auszufüllen

Setzen Sie in TableRow weight = "1".

activity_main.xml



<TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

table4.PNG

Ich möchte den Bildschirm vertikal und horizontal ausfüllen

Setzen Sie shrinkColumns und weight = "1".

activity_main.xml


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:shrinkColumns="0,1,3,4">

<TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

table5.PNG

Recommended Posts

Füllen Sie den Bildschirm mit Schaltflächen in TableLayout
Zeigen Sie die Liste in setDetails mit Federsicherheit auf dem Bildschirm an
Zeichnen Sie den Bildschirm mit Thymeleaf in SpringBoot
Mit CSS in die Mitte legen
Verwenden Sie JDBC Manager mit den Einstellungen in jdbc.dicon.
So ändern Sie die Aktion mit mehreren Senden-Schaltflächen
Organisierte schrittweise Interaktion mit dem JDK
Pulldown in der ursprünglichen App mit Active Hash implementiert
Wechseln Sie den Bildschirm, wenn Sie mit jQuery über eine Registerkarte fahren
Notiz, die zum Anmeldebildschirm übergeht, wenn Sie nicht mit devise angemeldet sind
In Redmine können Sie das Projekt mit Project.find (<Kennung>) abrufen.
Wenn sich dies mit der Option disable_with in Safari nicht ändert
Ich möchte im gespeicherten Zustand zum selben Bildschirm wechseln
Verwenden Sie mit Rails6 Ihre eigene Klasse im lib-Verzeichnis
Finden Sie mit Kotlin die Anzahl der Tage in einem Monat