0
我想在水平方向的單個線性佈局中添加兩個按鈕,如果屏幕較大,我希望我的按鈕拉伸,如果屏幕較小,我需要做些什麼來保持這些按鈕完全一樣的大小一起?使用按鈕的Android XML佈局
填充父項或匹配父項只會導致在屏幕上顯示一個,應該如何使它們在任何屏幕尺寸上同時可見?
我想在水平方向的單個線性佈局中添加兩個按鈕,如果屏幕較大,我希望我的按鈕拉伸,如果屏幕較小,我需要做些什麼來保持這些按鈕完全一樣的大小一起?使用按鈕的Android XML佈局
填充父項或匹配父項只會導致在屏幕上顯示一個,應該如何使它們在任何屏幕尺寸上同時可見?
給他們兩人的以下屬性:
weight =1
layout_width=fill_parent
這裏是工作的代碼
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button 1" >
</Button>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button 2" >
</Button>
</LinearLayout>