我需要爲屏幕上的按鈕設置相同的尺寸。這些按鈕有不同的內容(不同的長度)。我希望它看起來像3號線在畫面LinearLayout組件大小。重量如何影響尺寸
我想:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="B" />
但我得到了兩個不同大小的小按鈕在屏幕的中心。哪裏不對? 請舉個例子。
謝謝。有用。請你解釋一下嗎? – user1277317 2012-03-18 20:02:18