私は現在、これを持っている:GridLayoutのボタンサイズを「match_parent」に変更するにはどうすればよいですか?
そして、私が取得しようとしているこの:
私は今、1時間以上試してみましたが、それは働いてもらうように見えることはできません。以下の私のXMLを見てください。私は「match_parent」のように、彼は全体で行われる最後のボタンを変更するにはどうすればよい
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:background="@drawable/png1"
android:layout_height="match_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="Button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:id="@+id/button1" />
<Button
android:text="Button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:id="@+id/button2" />
<Button
android:text="Button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:id="@+id/button3"
android:layout_row="1"
android:layout_column="1" />
<Button
android:text="Button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:id="@+id/button4"
android:layout_row="1"
android:layout_column="0" />
<Button
android:text="Button"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:id="@+id/button5"
android:layout_row="2"
android:layout_column="0" />
</GridLayout>
</LinearLayout>
? おかげ
から回答を受け入れました。アンドロイド:layout_width = "100dp"をandroid:layout_width = "match_parent"に設定しようとしましたが、これが起こります:https://i.gyazo.com/11594914718f3351ac8d35b58ab5c138.png –
私の編集した投稿をチェックしてください。それはあなたが望む結果を与えるはずです。 –