Answer the question
In order to leave comments, you need to log in
How to design in Android?
I have 4 folders: drawable-xhdpi, drawable-hdpi, drawable-mdpi, drawable-ldpi, it is clear that images with dpi should be thrown into each folder: ~ 320, ~ 240, ~ 160, ~ 120, respectively.
But what about different screen resolutions, because different resolutions have different aspect ratios?
how to draw backgrounds
Answer the question
In order to leave comments, you need to log in
1 - Use 9-patch developer.android.com/tools/help/draw9patch.html
2 - Use one-pixel placeholders (Although this is more for the background of buttons, not activities)
3 - As experience has shown, there are two most popular aspect ratios:
a ) 1.77 (480x854, 960x540, 1280x720 )
b) 1.6 (480x800, 1280x800)
Accordingly, you can programmatically determine the ratio and, depending on this, load the desired resource with the maximum resolution. (That is, you do not need your own picture for each resolution. Scaling from larger to smaller does not spoil the image if it is performed for one aspect ratio).
In my practice, I use all three options. It all depends on the situation and free time of the designer.
you need to try to make an adaptive design that has special zones that stretch / shrink as needed. if it was not possible to do this, then:
use built-in filters to provide resources for specific device parameters, in addition to x/h/m/ldpi, there are several more applicable to the screen (Available width/height, for example), using filters, you can use filters for each permission to cut the background
use software tools, if the filters do not help, to give the application the necessary resources
in the case of a background, you can make it with a margin, for example, a background of 480x854 is great for 480x800, only part of the background, in the second case, will be outside the screen .
you can scale the background in runtime, for example, stretch 480x800 to 480x854, but this is not good, the clarity is lost.
If the background is simple, you can not store it in resources at all, but draw it yourself on the canvas for the desired option ... there are a lot of options)
1. A very useful resource that will prepare your pictures at once in 4 resolutions. There is also a set of standard pictures for the action bar. goo.gl/bV8fH
2. Design, depending on the state, of graphic elements is described in xml selector, which is then set to background
3. Use 9patch to create drawable resources
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question