0

I am creating Layout with absolute pixel resolution. For Example 10801920 , 10802160 for these pixel resolution I am creating Layout XML Files. enter image description here

Like the Image Mentioned above. But I added background Color Black to default and Red to 19201080. For 19201080 Simulators with that pixel Resolution not taking Red Color.This i am doing to create different UI for differnet screen Sizes in Android

Ruban4Axis
  • 821
  • 6
  • 27

2 Answers2

0

Android doesn't suggest that approach. Check the link below and the note I quote.

https://developer.android.com/training/multiscreen/screensizes

Note: The sizes that you specify using these qualifiers are not the actual screen sizes. Rather, the sizes are for the width or height in dp units that are available to your activity's window. The Android system might use some of the screen for system UI (such as the system bar at the bottom of the screen or the status bar at the top), so some of the screen might not be available for your layout. If your app is used in multi-window mode then your app only has access to the size of that window. When the window is resized, it triggers a configuration change with the new window size so the system can select the appropriate layout file. Thus, the sizes you declare should be specifically about the sizes needed by your activity—the system accounts for any space used by system UI when declaring how much space it provides for your layout.

Mohit Ajwani
  • 1,328
  • 12
  • 24
0

The approach you are following will not work. You should create your activity in different folder with name like

layout-sw720dp which is used for tablet 10"

res/layout-sw720dp/main_activity.xml

So at the end your folder structure might look like this:

res/layout/main_activity.xml -> for handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml -> for 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml -> for 10” tablets (720dp wide and bigger)

Check this answer for more understanding

Akshay
  • 752
  • 1
  • 8
  • 25