How to design any screen size and density in Android (multi-screen mode for mobile phones in Android)

How to cope with the design in multi-screen mode for Android mobile phones without using markup in the values ​​folder.

My application supports all Android mobile phones, and I had a design problem because I use the dimen in values ​​folder to process it.

Therefore, please, anyone can help me deal with this problem without using size.

+2
android android-layout
Apr 24 '16 at 8:11
source share
3 answers

layout compatibility is a very important part of any project

Sorry, but you should use a diameter to solve this problem. and I think the best way to design is to use density.

you can use dimens-hdpi or dimens-mdpi or ...

and it can use dimens-small or dimens-large or ...

and can use both of them together. e.g. dimens-larg-mdpi

but it is so hard to develop.

i using dimensions the smallest screen width is the density of use, and I think you can handle all phones or tablets into 4 or 5 sizes.

like this image enter image description here

Typical numbers for dp screen widths are:

  • 320: phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc.).
  • 480: Tweener tablet such as Streak (480x800 mdpi).
  • 600: 7-inch tablet (600x1024).
  • 720: 10-inch tablet (720x1280, 800x1280, etc.).
  • If you have a device that does not support one of them, you can add another smallest screen width for this.

You can read more here , here , here, and this one will help you find out the pixels of your phone per inch.

Example:

you have a phone with a size of 1080 * 1920 pixels and a size of 5 ".

enter image description here

  • The first formula will help you calculate the pixel per inch (dpi).
  • the second formula will help you calculate the pixel ratio.
  • and the last formula will help you calculate dp.

This phone has a width of 392 dp and a minimum width of 320.

if you like to use dpi the pixel ratio can help you.

  • ldpi => Pixel Ratio = 0.75
  • mdpi => Pixel Ratio = 1.0
  • hdpi => Pixel ratio = 1.5
  • xhdpi => Pixel Ratio = 2
  • xxhdpi => Pixel Ratio = 3
  • xxxhdpi => Pixel Ratio = 4
+12
Apr 24 '16 at 9:45
source share

if you want to support all resolutions (ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi), you can put your images in these folders. For text sizes, it is recommended that you use the size folder. But if you do not want to use the size folder, you can select the device resolution programmatically and change the text size

+2
Apr 24 '16 at 9:01
source share

mipmap-hdpi , mipmap-mdpi , mipmap-xxhdpi , this folder is what you need to use them for different resolutions

you can read: http://developer.android.com/guide/practices/screens_support.html

+1
Apr 24 '16 at 8:39
source share



All Articles