Zookey
Zookey

Reputation: 2707

How to design for 3.2" and 4.7" Android screens?

I need help with designing layout for Android devices. I have these layout folders:

But problem is because it seems that I must use same dimensions for layouts with 3.2 inch and for layouts with 4.7 inch.

Is there way to seperate these stuff? Because layout with dimension for 3.2 inche screen can't look good on 4.7 inch screen. As you can see frome the pictures below, on 4.7 inch screen there is a lot of empty space.

3.2 inch Android screen

enter image description here

4.65 inch Android screen

enter image description here

Upvotes: 1

Views: 1124

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007399

Generally speaking, you want to avoid using dimensions for widget sizes. There will be cases when it is unavoidable, or even advisable, but it is difficult to create "fluid" layouts that way.

If you want widgets that take up a certain percentage of the screen, use LinearLayout and android:layout_weight, using the weights to allocate the available space:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <Button
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="50"
        android:text="@string/fifty_percent"/>

    <Button
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="30"
        android:text="@string/thirty_percent"/>

    <Button
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="20"
        android:text="@string/twenty_percent"/>

</LinearLayout>

Upvotes: 1

Related Questions