10
我正在玩選項measureWithLargestChild="true"
。如果我的某個按鈕的文字太大,我不明白爲什麼我的佈局會完全打破。我認爲它應該保持1/3的基本尺寸,但是它們會變小約1/6。這是爲什麼?瞭解measureWithLargestChild:爲什麼打破布局?
在這裏你可以看到一些截圖:
這裏是我的xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:measureWithLargestChild="true" >
<Button
style="@style/my_style"
android:layout_weight="1"
android:text="Button123456" />
<Button
style="@style/my_style"
android:layout_weight="1"
android:text="A" />
<Button
style="@style/my_style"
android:layout_weight="1"
android:text="WW" />
</LinearLayout>
</LinearLayout>
有人能解釋爲什麼它收縮在情況2(4例中)。這種情況下怎麼沒有空間? – Diffy 2014-07-25 11:47:53