0

In android, How to set ui according to mobile resolution Without using layout_large_xhdpi..etc..

Dilberted
  • 1,172
  • 10
  • 23
Karthik
  • 167
  • 1
  • 5

2 Answers2

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)

Detailed Description

Vins
  • 4,089
  • 2
  • 35
  • 50