Ranjithkumar
Ranjithkumar

Reputation: 18386

Supporting Multiple Screens -tablet with low resolution support

I already read the developer guide & also refer many SO questions. but I'm still not sure what is the proper way.

I am develop the application only for Tablet.

I have the following folders,

Also In the manifest file, I have definied the followings,

<supports-screens 
android:largeScreens="true" 
android:anyDensity="true" />

If screen resolution greater than 800 * 480 -> application working properlly

My problem,

I tested the same application in china based device with 503 * 320 resolution,

It doesn`t works properly.

Please, tell me how to solve this issue.Thanks.

Update:

Tablet with high resolution,

enter image description here

Tablet with low resolution,

enter image description here

home.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="@color/layout_light_background">

<Button
    android:id="@+id/btn_dine_in"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:background="@color/orange"
    android:paddingBottom="20dp"
    android:paddingLeft="100dp"
    android:paddingRight="100dp"
    android:paddingTop="20dp"
    android:text="@string/dineIn"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/white" />

<Button
    android:id="@+id/btn_delivery"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="40dp"
    android:layout_marginStart="40dp"
    android:layout_marginTop="90dp"
    android:layout_toLeftOf="@+id/textView"
    android:layout_toStartOf="@+id/textView"
    android:background="@color/orange"
    android:padding="20dp"

    android:text="@string/delivery"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/white" />

<Button
    android:id="@+id/btn_collection"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/btn_delivery"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"
    android:layout_marginRight="40dp"
    android:layout_toEndOf="@+id/textView"
    android:layout_toRightOf="@+id/textView"
    android:background="@color/orange"
    android:padding="20dp"
    android:text="@string/collection"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/white" />

<Button
    android:id="@+id/btn_previous_orders"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignEnd="@+id/btn_delivery"
    android:layout_alignLeft="@+id/btn_delivery"
    android:layout_alignParentBottom="true"
    android:layout_alignRight="@+id/btn_delivery"
    android:layout_alignStart="@+id/btn_delivery"
    android:layout_marginBottom="71dp"
    android:background="@color/orange"
    android:paddingBottom="20dp"
    android:paddingLeft="100dp"
    android:paddingRight="100dp"
    android:paddingTop="20dp"
    android:text="@string/previousOrders"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/white" />

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"

    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/btn_delivery"
    android:layout_centerHorizontal="true"
    android:text="                  " />

<TextView
    android:id="@+id/textView12"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    android:text="@string/sampleRestaurantName"
    android:textSize="@dimen/restaurantNameFontSize"
    android:textStyle="bold" />

<Button
    android:id="@+id/btnAssignDriver"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignEnd="@+id/btn_collection"
    android:layout_alignRight="@+id/btn_collection"
    android:layout_alignTop="@+id/btn_previous_orders"
    android:layout_toRightOf="@+id/textView"
    android:background="@color/orange"
    android:paddingBottom="20dp"
    android:paddingLeft="100dp"
    android:paddingRight="100dp"

    android:paddingTop="20dp"
    android:text="@string/assignDriver"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/white" />
    </RelativeLayout>

Currently all of the three folders contains same xml file..

layout/home.xml title is Normal

& layout-large/home.xml title is MyRestaurant

Upvotes: 1

Views: 98

Answers (2)

hasan
hasan

Reputation: 24205

I believe I just found it.

Font size from device to device differs for devices with different resolutions when setting text appearance.

android:textAppearance="?android:attr/textAppearanceLarge"

Since previous orders is a long sentence it didn't fit in its button. because its button width equals to the delivery button width. and because left and right padding is so large 100dp the space left for text is small. thats why the button increased its height cause height is wrap content.

Upvotes: 1

hasan
hasan

Reputation: 24205

Since your app. doesn't support language directions. you don't have to include the attributes with end and start.

Those will affect the layout appearance if device language direction is different than you expected. which is the language you tested your app on. "English"

Remove everything that have the words end and start in it as:

android:layout_toEndOf="@+id/textView"
android:layout_marginStart="40dp"

and others. do that and check the results.

Upvotes: 1

Related Questions