↓ Ich möchte diese Schaltfläche auf die volle Breite erweitern.
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">
Es verbreitete sich wunderschön.
Diesmal, wenn sich die Schaltfläche über die Bildschirmbreite hinaus erstreckt.
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">
Es passt.
Setzen Sie in TableRow weight = "1".
activity_main.xml
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
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">
Recommended Posts