Hitesh Patel
Hitesh Patel

Reputation: 2878

Fit to screen all widgets

This is the screen shots. I want this buttons display in fit to screen for all devices.

I want to remove space after Button6 and fit all buttons in screen.

Image

Upvotes: 0

Views: 484

Answers (2)

kalpana c
kalpana c

Reputation: 2739

Use :

res/values-ldpi/dimens.xml

res/values-mdpi/dimens.xml

res/values-hdpi/dimens.xml

set button height

<!-- 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>

Upvotes: 2

VenomVendor
VenomVendor

Reputation: 15382

<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>

Upvotes: 3

Related Questions