Umayaeswaran S
Umayaeswaran S

Reputation: 1

Android app Screen resolution issue

I have developed an android app with the detailed resource structure: I have all my images in high resolution within the folder drawable-hdpi and afterwards I created layout for separate screen resolution as layout-hdpi, layout-large, layout-xlarge and some others.

I didn't get the exact layout in high resolution emulators such as Nexus 7, 10.1 WXGA(Tablet) and 7.1 WSVGA(Tablet) and so on...it didn't takes my exact design for those screen size, it always refer to "layout" rather than layout-xlarge.

Does anyone know why my separate layouts aren't being used?

Upvotes: 0

Views: 1663

Answers (4)

Manjeet Singh Goyal
Manjeet Singh Goyal

Reputation: 186

Put screen tag in your androidmanifest file

<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"/> 

this help to run ur code on multipal devices with compability.

Upvotes: 0

Andrew Cranston
Andrew Cranston

Reputation: 396

Using layout-large, layout-xlarge is no longer recommended. Google says to target tablets using sw* layouts.

eg To target 7 inch tablets, put the layout in layout-sw600dp. For 10 inch tablets, put them in layout-720dp.

The only exception is when targeting buggy devices such as the original galaxy tab running android 2.x, due to a bug in layout resolution you'll need to create a folder called layout-xlarge-land and place the layout there.

Additionally, don't just have high res images and dump them in hdpi. Properly scale your images and put them in mdpi, hdpi, xhdpi etc.

Most of the time, this will result in a much faster load time for the app, and a smaller APK size because you're not bundling "high resolution images" and making the framework scale the image on request. Having unoptimized images in your package will also have consequences with memory usage, as bitmaps are stored on the java heap.

Upvotes: 2

duggu
duggu

Reputation: 38439

For more detail visit this site http://developer.android.com/guide/practices/screens_support.html

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp

Upvotes: 0

Danny
Danny

Reputation: 1050

Use your fields in the place where you want such as images,textview or edittext. Align them clearly in each and every layout.

 layout for the normal mobiles devices(mdpi)
 layout-large for the hdpi devices like nexus
 layout-xlarge for the xhdpi devices like tablets

we can know your issue clearly if you post the code that will be good a lot.

create a drawable folder and place the images.

Upvotes: 0

Related Questions