Android multi-screen design

I understand that there is a lot of development documentation to support multiple screens in Android. and I read the Android manual here , as well as a number of related questions like this

However, I'm still a little confused about how I should implement it for my application. I plan to target the following device configurations.

enter image description here

Do I think that I will need to structure the layout of the project as follows:

  • Medium Density Typical HVGA 320x480 screens (160 dpi):

    res/layout-mdpi (320 x 480 ) res/layout-land-mdpi (480 x 320 ) 
  • High Density Conventional WVGA800 480x800 (x854) (240 dpi) Screens

     res/layout-hdpi (480 x 800) res/layout-land-hdpi (800 x 480) 

But what about density media, large screens?

I plan to also use kits for both high and medium density. My main concern at this early stage is to use suitable background images for each layout. For example, to support the sizes 480x800 and 480x854 , I plan to just use ImageView as a background, for example:

 <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bg" android:scaleType="center"/> 

The highlighted 'bg' will always be 480x854 and with:

 android:scaleType="center" 

I hope this takes care of these two screen sizes. Thanks to which the image retains its original appearance, but is focused on 480x800 screens. I will lose a few pixels from the image, but as long as the image does not scale, it fits my needs.

I plan to have a set of 320x480 assets for regular screens.

I just hope that I will follow the correct procedure, so I appreciate any information / advice from you guys. thanks in advance

+4
source share
1 answer

In my experience, you don't need to customize the layout for small / medium / large / etc screens if you have your drawings for different densities. As in the documentation, Android will try to correctly display your layout on different screen sizes.

By default, Android resizes your application to fit the current screen of the device. In most cases, this works great. In other cases, your user interface may not look so good and may need adjustments for different screen sizes.

"Other cases" apply only if you really want to change the layout on large screens.

Using android:scaleType="center" works for me, but it, as you said, will leave an empty space around your layout on large screens if it also fits on smaller screens. If you have a fully customized view with β€œwidgets” that needs to be placed exactly and you don’t want to programmatically determine the scaling and apply the same scaling to your widgets, this is definitely the way to go.

+3
source

All Articles