Screen Sizes and Layouts

I'm currently stuck with what might be a problem with understanding documents.

I read documents supporting multiple screens , and I have some problems, in particular, with layoyt differences between HTC Desire and HTC Legend .

From my point of view, looking at the screen matrix in the developerโ€™s documents, Legend is a โ€œnormalโ€ screen, and Desire is a large screen.

Adding layouts of layout directories /, layout-small and layout-major solved my problems with small screen devices. But now, trying to make the application look good both in Desire and Legend, it seems that both of them use the usual screen layout.

Any hints, solutions or explanations?

+3
source share
3 answers
HTC Desire - whose screen is 480x800 WVGA800 - is considered a normal hdpi screen, and HTC Legend - whose screen is 320 X 480 HVGA - is considered a normal mdpi screen (see table 1 here ). Thus, the usual screen layout and mdpi graphics are used for both devices, but since Desire has an hdpi screen, Android scales the graphics (as a rule, the result is that they look blurry). For the layout to look good on Desire, you must provide hdpi graphics and put them in a folder called drawable-hdpi.
+2
source

In layouts, I use layouts to indicate sizes. This will help greatly when launching the application on various screen devices.

layout_weights ,
http://mobiforge.com/designing/story/understanding-user-interface-android-part-1-layouts

0

Try using wrap_content, fill_parent or dp unit in your regular layout. In any case, creating multiple layouts, as you do, is tedious, but perhaps the best option. Set it in your manifest

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

and get the screen size used with

DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
height = displaymetrics.heightPixels;
width = displaymetrics.widthPixels;
Log.e("FirstImage", "Width = "+width+"Height = "+height);

Once you have the screen size, I think you know how to assign it a specific predefined layout.

Hope this helps if you still have any problems, comment below and we will see how to solve it!

0
source

All Articles