Android Layout Design Principles

I learned a lot about the best ways to design layouts for different screen sizes, screen densities, and orientations, and I'm getting more and more confused.

1. Design density and screen size
I read this link

Now that you are designing for gingerbread, what to consider. The layouts in each folder say LDPI, HDPI and MDPI. But this increases the size of the entire application.

Now I stopped considering LDPI. But now we also have XHDPI and XXHDPI. So, how do we plan to design for all pages and still keep the size reasonable?

And what size, density or screen resolution should be set for preferences?

FOr images 9-patch imagescan be used. What is the best way to create them?

2.Landscape vs Potrait.

Now in this mock equation, if we include different layouts for screen orientation, the application becomes cumbersome and the work is tedious.

Creating smaller xmls and including them is one good solutionbut even then, given all the different types, it still becomes tedious. Especially for Android 4 and above, each fragment has a different layout,

My question is: what is the best and most effective way to develop layouts, given all of the above.

+4
source share
3 answers

Play Store APK . , , APK. <compatible-screens>. , , ldpi, :

<compatible-screens>

    <screen android:screenSize="small" android:screenDensity="ldpi" />

</compatible-screens>

, APK , , res/drawable , APK. APK Play APK Play Store Services (.. Play Store, Android) .

:

1. APK.

2. .

3. Google Play.

+2

: . .

9-- .

  1. Android-

,

, :

res/layout/my_layout.xml             // normal screen size ("default")
res/layout-small/my_layout.xml       // small screen size
res/layout-large/my_layout.xml       // large screen size
res/layout-xlarge/my_layout.xml      // Hd tablet

.

        res/layout/              # default (portrait)
            main.xml
        res/layout-land/         # landscape
            main.xml
        res/layout-large/        # large (portrait)
            main.xml
        res/layout-large-land/   # large landscape
            main.xml


1. You can also use `qualifier` for having multipal resource. 
+7

, , / ,

 - ldpi  - mdpi  - hdpi  - xhdpi  - nodpi  - tvdpi

, dimens, integers, booleans ..

XML- - android:width="@integer/size_for_this"

Android , DPI. , , , ..

+2

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


All Articles