私は6つのボタンでレイアウトを作成しようとしています。コードでは、6つのボタンを動的に作成しますが、2つはライン用ですが、ボタンは後者を満たす画面のサイズに合わせる必要があります。どうすればいいですか?ウィンドウタイルのような6つのボタンを使ってレイアウトを作成する方法
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/conv_up" />
<Button
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/conv_up"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/conv_up"
/>
<Button
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/conv_up"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/conv_up"
/>
<Button
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/conv_up"
/>
</LinearLayout>
あなたが今見ているものと期待しているものを載せてください。それ以外の場合は答えが難しいでしょう。 – Siddharth
このコードは私にこのエラーが表示されるので、何も表示されません。「疑わしいサイズ:これはビューを非表示にし、LinearLayoutのlayout_weightで使用する必要があります」android:layout_height = "0dip" – bisemanu
「0dip」が問題です。 – Siddharth