In android, How to set ui according to mobile resolution Without using layout_large_xhdpi..etc..
Asked
Active
Viewed 375 times
2 Answers
1
Well, you can do it programmatically by getting the size of the display (see Get screen dimensions in pixels) and then resizing your views accordingly.
But this is gonna be a huge headache and it's simply better to use the simple system provided by default (different layouts and resources for small, medium, large, extra large, ldpi, mdpi, hdpi, xhdpi etc)

Community
- 1
- 1

Anup Cowkur
- 20,443
- 6
- 51
- 84
0
I'm not sure whether there is any exact way to define layouts depending upon screen resoulution , but other different ways depending on screen width/height can be used like
res/layout-w600dp/ (for 600dp screen width)
res/layout-h1024dp/ (for 1024 screen height)

Vins
- 4,089
- 2
- 35
- 50