Zbarcea Christian
Zbarcea Christian

Reputation: 9548

Should I create different layouts for different displays?

This is how my layout looks on the phone (landscape):

enter image description here

button wrapper (marginTop 10dp, margin left 5dp and 3 dp between buttons)

The problem is when I run the same layout on the tablet:

enter image description here

As you can see there is an extra space below the button wrapper.

Am I need to create different layout for each device display?

Upvotes: 0

Views: 61

Answers (3)

T_V
T_V

Reputation: 17580

You can do with help of this

    res/layout/my_layout.xml             // layout for normal screen size ("default")
    res/layout-small/my_layout.xml       // layout for small screen size
    res/layout-large/my_layout.xml       // layout for large screen size
    res/layout-xlarge/my_layout.xml      // layout for extra large screen size
    res/layout-xlarge-land/my_layout.xml // layout for extra large in landscapeorientation

for drawable

    res/drawable-mdpi/my_icon.png        // bitmap for medium density
    res/drawable-hdpi/my_icon.png        // bitmap for high density
    res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

I think you need this

res/layout/main_activity.xml   # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)

http://developer.android.com/guide/practices/screens_support.html

Upvotes: 0

Sreedev
Sreedev

Reputation: 6653

Yes you should create another layout for tablets. if the layout for the phone comes in tabs obviosly it will get smaller..youcan go through this oink about creating different layouts for different displays..Mainly for layouts will be provided for an app

layout-small , layout , layout-large , layout-xlarge,

Link

Upvotes: 2

Ishant Sagar
Ishant Sagar

Reputation: 228

Iam not getting what your actual point is..but yes for tablets you need to make different xml layout files which are put under layout-large and layout-xlarge(depending upon your requirement) folders. And if you'r not doing so then your tablet will render the layout from your default layout folder. Is this what you were asking ?

Upvotes: 0

Related Questions