How to decide Android screen size for different mobile devices?

I am testing an Android application on a small mobile screen. If I use Samsung tablets, like other landscapes, to test my Android app, the content moves a bit. How to solve screen resolution in Android?

+6
source share
5 answers

I think you should better check it out on the Developer website, where you have all the information. Here is multi-screen support in Android

+6
source

use this in manifest.xml

<supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/> 
+3
source

you can create several layouts to fit the screen (four different screen sizes) and place them in different folders under res, as shown below

 res/layout/my_layout.xml // layout for normal screen size ("default") res/layout-small/my_layout.xml // layout for small screen size res/layout-large/my_layout.xml // layout for large screen size res/layout-xlarge/my_layout.xml // layout for extra large screen size res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation 

You also need to add the lines below to the manifest file

 <supports-screens android:resizeable="true" android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/> 

For more information check this link.

+1
source

Try not to write things in terms of px. Try using fill_parent wrap_content. Under very necessary circumstances, create separate folders for your layout, as in layout, layout, layout, layout, layout, layout, etc. Place the layout in these folders and change the layout settings. Rest will depend on the Android OS.

0
source

I think that you shuold will get the screen resolution when using java code, and then set the size of the widgets dynamically in the oncreate() method of activity , using the specified resolution.

-1
source

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


All Articles