Set portrait only orientation on devices with a screen size of less than 7 inches

86 views Asked by At

I am creating an android application that I want to:

  • Run portrait only orientation on screen sizes (6.9"-)
  • Run portrait and landscape orientations on screen sizes (7"+)

How would I declare this without using androids deprecated (small, normal, large, xlarge) screen sizes?

1

There are 1 answers

0
Adam Fręśko On BEST ANSWER

Store some Boolean in values folders. There can be multiple values folders like values-h720dp or values-w320dp. Then read those data in oncreated method of activity and then set proper orientation. To learn more read this