Вопрос по android – Размеры заставки Android для всех устройств

202

Error: User Rate Limit Exceededldpi, mdpi, hdpiError: User Rate Limit ExceededxhdpiError: User Rate Limit Exceeded

android.cyrilmottier.com/?p=632 CommonsWare
Error: User Rate Limit Exceededstackoverflow.com/questions/30494811/… Ramesh K
Error: User Rate Limit Exceeded Lucas Cerro
Error: User Rate Limit Exceeded keyser
Error: User Rate Limit Exceeded arielschon12

Ваш Ответ

9   ответов
11

.

9
Density buckets

LDPI    120dpi    .75x
MDPI    160dpi    1x
HDPI    240dpi    1.5x
XHDPI   320dpi    2x
XXHDPI  480dpi    3x
XXXHDPI 640dpi    4x

px / dp = dpi / 160 dpi
3

<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@drawable/flash_screen</item>
    <item name="android:windowTranslucentStatus" tools:ignore="NewApi">true</item>
</style>

<?xml version="1.0" encoding="utf-8"?>
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white"></item>
<item>
    <bitmap android:src="@drawable/background_noizi" android:gravity="center"></bitmap>
</item>

Error: User Rate Limit Exceeded
27

PORTRAIT

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

LANDSCAPE

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceededstackoverflow.com/a/19661363/1617737Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
2

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

388
Disclaimer

Here's the tl/dr version

Create 4 images, one for each screen density:

xlarge (xhdpi): 640x960 large (hdpi): 480x800 medium (mdpi): 320x480 small (ldpi): 240x320

Read 9-patch image introduction in Android Developer Guide

Design images that have areas that can be safely stretched without compromising the end result

end of tl;dr. Full post ahead

Fitting all sizes

Do your users really want to see a splash screen?

Screen density; 4 classes

ALL

Low Density (ldpi ~ 120dpi) Medium Density (mdpi ~ 160dpi) High Density (hdpi ~ 240dpi) Extra-High Density (xhdpi ~ 320dpi) (These dpi values are approximations, since custom built devices will have varying dpi values)

9-patch image

A few ground rules You can make these images in photoshop (or any image editing software that can accurately create transparent pngs). The 1-pixel border has to be FULL TRANSPARENT. The 1-pixel transparent border has to be all around your image, not just top and left. you can only draw black (#000000) pixels in this area. The top and left borders (which define the image stretching) can only have one dot (1px x 1px), two dots (both 1px x 1px) or ONE continuous line (width x 1px or 1px x height). If you choose to use 2 dots, the image will be expanded proportionally (so each dot will take turns expanding until the final width/height is achieved) The 1px border has to be in addition to the intended base file dimensions. So a 100x100 9-patch image has to actually have 102x102 (100x100 +1px on top, bottom, left and right) 9-patch images have to end with *.9.png

Example

9-patch image, 102x102px

the same image, magnified 2x for clarity

rendered into 100x100

rendered into 460x140

xlarge (xhdpi): 640x960 large (hdpi): 480x800 medium (mdpi): 320x480 small (ldpi): 240x320

ANY

Error: User Rate Limit ExceededdocumentationError: User Rate Limit ExceededxlargeError: User Rate Limit ExceededxhdpiError: User Rate Limit ExceededDensity and size are different concepts.
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
102
PORTRAIT MODE

LANDSCAPE MODE

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
16
Error: User Rate Limit Exceeded
2

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Похожие вопросы