0
私のレイアウトはFigure.soに示すようにしたいweightsum.butデザインを使用しています。実際のレイアウトと背景色を除いて表示されません。 weightSum
属性がLinearLayout
内で宣言されなければならない私0dpを設定してもweightsumが動作しない
xmlファイル内のコード
<RelativeLayout
android:weightSum="100"
android:background="#C5C5C5"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_width="fill_parent">
<LinearLayout
android:layout_weight="45"
android:id="@+id/signinBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corner">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign In"
android:gravity="center"
android:padding="5dp" />
</LinearLayout>
<LinearLayout
android:layout_weight="10"
android:layout_width="00dp"
android:layout_height="wrap_content"
android:id="@+id/signinBtn" />
<LinearLayout
android:layout_weight="45"
android:id="@+id/cancelBtn"
android:layout_width="00dp"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corner">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Cancel"
android:gravity="center"
android:padding="5dp" />
</LinearLayout>
</RelativeLayout>
最初のものは、あなたが 'weightsumを使用していないですのような重量を使用する線形レイアウトする必要があります'どこで、なぜあなたは' android:layout_weight'でこのような大きな値を使用していますか? –
あなたは完全に重量の概念を台無しにしました。 weightsum属性を持つビューの幅は0dpではありませんが、その子は –
です残りの部分は10です。 –