IslamKhSh / Xdimen

Easily support android multiple screen sizes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for both orientation.

kyawhtut-cu opened this issue · comments

I want to set dimen for both orientation. how should I do it?

for eg. values-w483dp and values-w483dp-port automatically generated and the dimen values set to specific orientation.

Thanks for your request.

Xdimen scales the dimensions depending on the devices' width regardless of the orientation.
I can't find a case where we need to combine orientation qualifier with width qualifier as scaling dimensions don't care about the orientation.

e.g: Suppose we have two devices with screen dimensions:

  • 400dp x 600dp.
  • 600dp x 900dp.

here when the first device is in landscape mode its width is 600dp, and when the second is in the portrait mode its width is also 600dp, and for both, we need the same scaled dimension.

I categorized the predefined devices' widths into some sets regarding their type and orientation, you can combine more ones like this

Kotlin
 xdimen {
    targetDevicesWidth.set(phonePortrait + phoneLandscape)
    ....
 }
Groovy
   xdimen {
    targetDevicesWidth = phonePortrait + phoneLandscape
    ....
  }

and this will generate scaled dimensions for all devices' widths in phonePortrait and phoneLandscape without orientation qualifier.

I hope this comment helps you, and hope to hear from you if things are not clear enough yet.

What about it? Is my answer helped you?

I'll close this issue, If my answer not helped you feel free to comment on it and I'll reopen