0

I can't really understand what to do with diffrent phone/tablet screens. I reference retrieval google nexus s screen looks perfectly (800x480) but especially on tablets looks terrible. at left corner 1/4 size. all rest of screen is just junk.

what I do on my xml is like this;

<LinearLayout>
<RelativeLayout fill_parent>
<LinearLayout height="fill_parent" width="387dp">
RIGHT SCREEN
</LinearLayout>

<LinearLayout height="fill_parent" marginLeft="387dp" width="147dp">
LEFT SCREEN
</LinearLayout>
</RelativeLayout>
</LinearLayout>

enter image description here

Mert
  • 6,432
  • 6
  • 32
  • 68
  • [Check](http://stackoverflow.com/questions/6316540/how-to-make-layout-with-view-fill-the-remaining-space) [This](http://stackoverflow.com/questions/5880513/how-to-make-a-linearlayout-filling-remaining-space-in-a-relativelayout) [Links](http://stackoverflow.com/questions/3676095/relativelayout-height-to-fill-remaining-space) – Synxmax Jan 22 '12 at 15:04

2 Answers2

1

You should include support for xlarge screens in the Manifest file. You can also design a separate layout for xlarge screens. Check this article

Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47
  • so should I design a xml file for each screen resoulution? – Mert Jan 22 '12 at 15:05
  • You create a folder inside the resource folder named layout-xlarge and scale your views to match the tablet. You can also work with relative view sizes (wrap_content and fill_parent) which will not be affected by screen size. – Mohamed_AbdAllah Jan 22 '12 at 15:11
  • should I check window size and decide which layout I should use or there is a way to get this is tablet or this phone (I think window size better idea) – Mert Jan 22 '12 at 15:44
  • xlarge is by default tablet (unless they get out a phone that meets these dimensions). Check the link I sent in my answer which specifies what qualifies as ldpi (small), mdpi (normal), hdpi (large) and xhdpi (xlarge) screens. Basicly, you won't need to adapt for other than those 4 screen resolutions/sizes. – Mohamed_AbdAllah Jan 22 '12 at 18:17
1

You could have:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
         android:id="@+id/left"
         android:layout_weight="1"
         android:orientation="vertical"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         >
    </LinearLayout>
    <LinearLayout
        android:id="@+id/right"
        android:layout_weight="2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    </LinearLayout>
</LinearLayout>

You could also use a RelativeLayout.

Jeremy D
  • 4,787
  • 1
  • 31
  • 38