Folder name for 7" hdpi tablet Android
Asked Answered
W

3

0

I have Tablet with 7" screen (600×1024) with hdpi (240 dpi classification).

I have created folder layout-sw600dp. But it's not working in this resolution tablet.

Its working fine with 7" screen (600×1024) with mdpi (160 dpi classification).

Which folder should I create for 7" (600×1024) tablet which has hdpi (240 dpi classification)?

Wellspoken answered 11/7, 2013 at 5:20 Comment(0)
A
0

Make Your Layout like 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)

For TAB:

For example, if your application is only for tablet-style devices with a 600dp smallest available width:

<supports-screens
                  android:requiresSmallestWidthDp="600" />

enter image description here

I have Tablet with 7" screen (600×1024) with hdpi (240 dpi classification) which is comes under the Normal Screen see my screen shot.Its working fine with 7" screen (600×1024) with mdpi (160 dpi classification) which is comes under the large screen.

For Tablet .

MULTIPLE SCREENS:

For example, the following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for medium, high, and extra high density screens.

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 landscape orientation

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

Hope this will help you.

Alliance answered 11/7, 2013 at 5:23 Comment(4)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger) res/layout-sw720dp/main_activity.xml I have tried with both the folder but not working.Wellspoken
Because I have Tablet with 7" screen (600×1024) with hdpi (240 dpi classification) which is comes under the Normal Screen see my screen shot.Its working fine with 7" screen (600×1024) with mdpi (160 dpi classification) which is comes under the large screen. Please check it with my screen shot.Alliance
what should be image size for normal Screen?Wellspoken
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 Check my edited answer it depends upon the density.Alliance
R
0

It depends from the Android API version you're building against, like mentioned here:

... However, this won't work well on pre-3.2 devices, because they don't recognize sw600dp as a size qualifier, so you still have to use the large qualifier as well. So, you should have a file named res/layout-large/main.xml which is identical to res/layout-sw600dp/main.xml. In the next section you'll see a technique that allows you to avoid duplicating the layout files this way.

You should also take a look here:

Preparing for Handsets

and

New Tools For Managing Screen Sizes

Rubicund answered 11/7, 2013 at 5:29 Comment(1)
android os is 4.1.2 so it can recognize sw600Wellspoken
O
0

In android, we use resolution in dp to measure the screen size, not resolution in px. Both of your two tablets have the same resolution in px, but their resolution in dp are quite different.

  1. 600 X 1024px with mdpi = 600 * 1024 dp

  2. 600 X 1024px with hdpi = 400 * 682 dp

You use sw600dp as the qualifier for tablet, which will effect the first device but not the second one.

In fact, the second device(400 * 682dp), is much more like a handset rather than a tablet, it should not use the layout for tablet.

Ostia answered 11/7, 2013 at 5:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.