Ich möchte folgendes Layout erreichen.Gleiche Breite aller Knöpfe
Wie kann ich die Taste 0 gleich Rest der Tasten. Bitte beachten Sie, dass ich layout_weight = "1"
verwendet habe, so dass alle anderen Tasten gleich lang sind, während sie dem Elternteil entsprechen. Seit dem habe ich Button 0 auf einem anderen Layout erstellt, so dass ich es nicht mit anderen Buttons gleich lang machen kann.
Hier ist mein Code so weit
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/seven"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
<Button
android:id="@+id/eight"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
<Button
android:id="@+id/nine"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/zero"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
erstellen zwei "Dummy" Buttons, die unsichtbar sind, an den Seiten von Button "0". Aber lassen Sie mich vorschlagen, dass Sie eine GridView statt einer Reihe von LinearLayouts verwenden. –