Allowed sizes for different screen sizes in android

I have a problem in the development of Android that I’m tired of. my problem is screen size and dealing with that. especially I have some problems with the images. for example, I want to create a background image for my activity, which I created in Photoshop, and my background image contains the word "HELLO". but when i put it in drawable-xhdpi folder it seems blurry and not sharp !! my phone is a link 4, and according to google documentation I am creating a 640 x 480 background image.

When I create a 960 x 720 background image, it seems better, but not perfect. in this case, the size of my image file is very high!

but what is the standard way to do this? Please help me solve this problem forever. I am reading Google documentation, but this does not solve my problem! http://developer.android.com/guide/practices/screens_support.html

+4
source share
4 answers

Usually, you should avoid creating images for certain screen sizes to make them a backdrop, because there are thousands of different devices and you will have to create dozens of such images.

The first thing you need to know is screen density.

Usually you create from 3 to 5 images, even despite the screen size: low (120 dpi), medium (160 dpi), high (240 dpi), ultra-high (320 dpi) and 2 * ultra-high (480 dpi). They go to drawable-Xdpi folders, where X is one of l, m, h, xh, xxh.

Next, when you want to have large images on large screens (large phones, small and large tablets), you can put the images in folders such as drawable-sw600dp-Xdpi. This does not apply to your phone.

Nexus 4 is an xhdpi 640x384 dp device, but you should not treat it differently than Samsung Galaxy S2 (hdpi 533x320 dp).

Create a smaller image for both phones and center it horizontally. For instance. 320x100 px for mdpi, 480x150 px for hdpi and 640x200 pixels for xhdpi (your phone).

+5
source

With 1600+ android models, even after they are classified in multiple screen sizes and multiple DPIs, it’s very difficult to manage layouts. I suggest you just focus on designing layouts to fit your screen and then create views as Resizeable Views to ignore density effects.

Once you have created your layouts, resize your views. You can create a custom view or resize it to onMeasure ();

+5
source

The screen resolution for Nexus is 1280x768 ( http://www.google.com/nexus/4/specs/ ), change the image size to this resolution. With special attention, some images cannot handle the resolution, and the image becomes disproportionate.

for interesting resolution calculator: http://members.ping.de/~sven/dpi.html

+1
source

This is an Android Fragmentation issue, and you just can't handle it, as there are several hundred different devices. As a colleague wrote, Nexus 4 has a resolution of -1280 x 768, so surely res images of 960 x 720 are a good choice. I am even surprised that google offers 640 x 480 for xhdpi, it is definitely too small.

So, I said that you cannot make perfect graphics for all existing devices. You must select the most popular devices from each category of screens (xhdpi, mdpi, ldpi ... etc.) in order to cover the most important market share.

+1
source

Source: https://habr.com/ru/post/1487720/


All Articles