1

I have created the different folders for multiple screens..

res/layout (for normal screens) res/layout-large (for large screens) res/layout-xlarge (for xhdpi screens)

when i have tested on grand 2 phone which is xhdpi, It takes the values from res/layout folder...

Is this a correct way to handle mutiple screen layout...and is there ant change I have to do in Android.manifest file??plz help me..thanks in advance..I have change the scrollbar size in two different layout...

res/layout/main.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/back1">
    <ScrollView
    android:layout_width="match_parent"
    android:layout_height="200dp"


    android:scrollbars="horizontal" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >



    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="33dp"
        android:layout_marginTop="2dp"
        android:text=""
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="33dp"
        android:text=""
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="33dp"
        android:text=""
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="264dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:text=""
        android:textColor="#FFFFFF" />


        <TableLayout
            android:id="@+id/maintable"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="20dp" >
        </TableLayout>




        <TableLayout
            android:id="@+id/maintable1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp" >
        </TableLayout>

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/list"
        android:text=""
        android:textColor="#FFFFFF" />

    <ListView
        android:id="@android:id/list"
        style=" android:listViewStyle"
        android:layout_width="fill_parent"
        android:layout_height="70dp"
        android:layout_below="@+id/textView6"
        android:layout_marginLeft="33dp"
        android:drawSelectorOnTop="true"
        android:textColor="#FFFFFF" >

    </ListView>
     </LinearLayout>

</ScrollView>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="0dp"

    android:orientation="horizontal"
      >
    <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="7dp"
        android:layout_gravity="bottom"
        android:text=""
        android:layout_marginBottom="5dp"
        android:textColor="#FFFFFF"
        android:textColorLink="#FFFFFF" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="12dp"
        android:layout_marginTop="1dp"
        android:layout_marginBottom="5dp"
        android:text=""
        android:layout_gravity="bottom"
        android:textColor="#FFFFFF"
        android:textColorLink="#FFFFFF" />
    </LinearLayout>
    </RelativeLayout>

res/layout-xlarge

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/back1">
    <ScrollView
    android:layout_width="match_parent"
    android:layout_height="400dp"


    android:scrollbars="horizontal" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >



    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="33dp"
        android:layout_marginTop="2dp"
        android:text=""
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="33dp"
        android:text=""
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="33dp"
        android:text=""
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="264dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:text=""
        android:textColor="#FFFFFF" />


        <TableLayout
            android:id="@+id/maintable"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="20dp" >
        </TableLayout>




        <TableLayout
            android:id="@+id/maintable1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp" >
        </TableLayout>

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/list"
        android:text=""
        android:textColor="#FFFFFF" />

    <ListView
        android:id="@android:id/list"
        style=" android:listViewStyle"
        android:layout_width="fill_parent"
        android:layout_height="70dp"
        android:layout_below="@+id/textView6"
        android:layout_marginLeft="33dp"
        android:drawSelectorOnTop="true"
        android:textColor="#FFFFFF" >

    </ListView>
     </LinearLayout>

</ScrollView>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="0dp"

    android:orientation="horizontal"
      >
    <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="7dp"
        android:layout_gravity="bottom"
        android:text=""
        android:layout_marginBottom="5dp"
        android:textColor="#FFFFFF"
        android:textColorLink="#FFFFFF" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="12dp"
        android:layout_marginTop="1dp"
        android:layout_marginBottom="5dp"
        android:text=""
        android:layout_gravity="bottom"
        android:textColor="#FFFFFF"
        android:textColorLink="#FFFFFF" />
    </LinearLayout>
    </RelativeLayout>
bhagyasri patel
  • 61
  • 1
  • 11
  • refer this [http://stackoverflow.com/questions/27142081/android-layout-folder-on-different-devices/27142152#27142152](http://stackoverflow.com/questions/27142081/android-layout-folder-on-different-devices/27142152#27142152) – Yugesh Nov 29 '14 at 06:42

2 Answers2

0

You are wrong saying "res/layout-xlarge (for xhdpi screens)". If you want to make different layouts attending to densities you should use hdpi, xhdpi, xxhdpi and xxxhdpi modifiers:

...
res/layout-hdpi ---> for HDPI screens.
res/layout-xxdpi ---> for XHDPI screens.
res/layout-xxhdpi ---> for XXHDPI screens.
...

large and xlarge modifiers were used (since Android 3.2 they are deprecated, meaning you should the modifiers above) to group devices in function of their size.

More information at http://developer.android.com/guide/practices/screens_support.html

Luciano Rodríguez
  • 2,239
  • 3
  • 19
  • 32
0

Try Layout folder like :

layout             // layout for normal screen size ("default")
layout-large       // layout for large screen size
layout-xlarge      // layout for extra-large screen size
layout-xlarge-land // layout for extra-large in landscape orientation

add support-screens in AndroidManifest.xml :

<supports-screens android:resizeable=["true"| "false"]
          android:smallScreens=["true" | "false"]
          android:normalScreens=["true" | "false"]
          android:largeScreens=["true" | "false"]
          android:xlargeScreens=["true" | "false"]
          android:anyDensity=["true" | "false"]
          android:requiresSmallestWidthDp="integer"
          android:compatibleWidthLimitDp="integer"
          android:largestWidthLimitDp="integer"/>

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

Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67