我正在尝试在屏幕上部创建一个带有 5 个按钮的导航栏。我希望按钮大小即使在不同的屏幕尺寸上也能保持不变并拉伸到屏幕的宽度。
我找到的最合适的解决方案是表格视图。问题是我找不到只有一个表格行并以线性视图继续屏幕的其余部分的方法。
在下面的示例中,EditText 出现在屏幕底部,而不是直接出现在导航栏之后。
有任何想法吗?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="1" android:id="@+id/tableRow2">
<Button android:layout_width="0dip" android:text="1" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n1"></Button>
<Button android:layout_width="0dip" android:text="2" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n2"></Button>
<Button android:layout_width="0dip" android:text="3" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n3"></Button>
<Button android:layout_width="0dip" android:text="4" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n4"></Button>
<Button android:layout_width="0dip" android:text="5" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n5" android:layout_margin="0"></Button>
</TableRow>
<EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="textPostalAddress">
<requestFocus></requestFocus>
</EditText>
</LinearLayout>