Hulk
Hulk

Reputation: 237

How to make layout for 8 inch tablet

Hello i am making an app in android which need to target 8 inch tablet. I can use weight sum to arrange my layout in proportion but in some layouts i have a button over imageview(in Relativelayout). Now when imageview expands the layout gets distorted. So please suggest me a way to target 8 inch tablet. Reading all other questions i could see sw-600dp but that is for 7 inch so what to do for 8 inch tablet. Moreover what is the resolution of 8 inch tablet.

Thanks. Plz help.

Upvotes: 0

Views: 2192

Answers (2)

user4619358
user4619358

Reputation:

sw720dp will do it for you. Because 8 inch tablet lies in the bucket sw720.

Upvotes: 2

King of Masses
King of Masses

Reputation: 18765

More over many of 8.0 inch tablets having the 1280 x 800 resolution. if you really want to know the exact resolution of your specific 8.0 inch tablet then simply you can get by using the following code

If you want the display dimensions in pixels you can use getSize:

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;

This method was introduced in Android API 13, so if you want to get display metrics for previous APIs use:

DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int wwidth = displaymetrics.widthPixels;

on Android you can specify smallest width on the resources. Examples:

layout-sw600dp/ < that's a 7" like the Nexus 7
layout-sw720dp/ < that's a 10" like the Nexus 10

so all you have to do is to find out what's the smallest width in DP for the 8 inches (probably something around 660dp) and create the resource folder for it.

Refer this link. Here they explained in detail regarding the screen support

http://developer.samsung.com/technical-doc/view.do;jsessionid=P0nhJ0Jh1VJhPQklhN1G1vJYrH5JWH2PYnv5RsP5pWfSxY86fgpb!361558248?v=T000000126

Upvotes: 7

Related Questions