Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for both orientation. #2

Closed
kyawhtut-cu opened this issue May 5, 2022 · 3 comments
Closed

support for both orientation. #2

kyawhtut-cu opened this issue May 5, 2022 · 3 comments

Comments

@kyawhtut-cu
Copy link

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.

@IslamKhSh
Copy link
Owner

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.

@IslamKhSh
Copy link
Owner

What about it? Is my answer helped you?

@IslamKhSh
Copy link
Owner

IslamKhSh commented May 14, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants