适合筛选所有小部件

时间:2012-06-12 08:19:59

标签: android android-layout

这是截屏。我希望这个按钮显示适合所有设备的屏幕。

我想在 Button6 之后删除空格,并在屏幕中显示所有按钮。

Image

2 个答案:

答案 0 :(得分:3)

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:orientation="vertical" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Button" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Button" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Button" />

    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Button" />
</LinearLayout>

答案 1 :(得分:2)

使用:

RES /值-LDPI / dimens.xml

RES /值-MDPI / dimens.xml

RES /值-HDPI / dimens.xml

设置按钮高度

<!-- in values-ldpi/dimens.xml -->
<dimen name="height">25dip</dimen>

<!-- in values-mdpi/dimens.xml -->
<dimen name="height">30dip</dimen>

<!-- in values-hdpi/dimens.xml -->
<dimen name="height">40dip</dimen>
相关问题