これはスクリーンショットです。このボタンをすべてのデバイスの画面に合わせて表示したいと思います。
Button6の後にスペースを削除し、すべてのボタンを画面に収めたい。
これはスクリーンショットです。このボタンをすべてのデバイスの画面に合わせて表示したいと思います。
Button6の後にスペースを削除し、すべてのボタンを画面に収めたい。
<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>
使用する :
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>