0

これはスクリーンショットです。このボタンをすべてのデバイスの画面に合わせて表示したいと思います。

Button6の後にスペースを削除し、すべてのボタンを画面に収めたい。

画像

4

2 に答える 2

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>
于 2012-06-12T08:37:07.193 に答える
2

使用する :

res / values-ldpi / dimens.xml

res / values-mdpi / dimens.xml

res / values-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>
于 2012-06-12T10:16:21.963 に答える