Home android How to split the logic of the vertical and horizontal position of...

How to split the logic of the vertical and horizontal position of the screen

Author

Date

Category

I have activity (or fragment) with Recyclerview , in which there are 3 selection points, on the opening of which the window opens with the appropriate inscription. If the phone \ tablet is in a vertical position, then I want to display the inscription in a new window, and if in a horizontal one – on the left Recycler , and on the right inscription. The photo led an example (I apologize for my Paint : D). How to split the logic (somehow magically control the activities or fragments, maybe something else) behavior on the vertical and horizontal position?


Answer 1, Authority 100%

If you are interested in the orientation separation Use suffixes for your resources: -land -port Naturally, if you initially, you developed your App for a device with portrait orientation, then you have enough Will make a folder for example Layout-Land and with landscape orientation, it will work, otherwise the values ​​will be taken by default from the original folder, even if there is no suffix -port .

When creating a new resource directory in AS, it shows it very well by qualifiers UI-MODE (I can log in).

If you want to split into tablets and phones, then with API 14 there is a sufifix SW600 – for 7-inch tablets, and SW800 for 10-inch tablets . Everything works absolutely similarly to the fact that it is written above.

Another point, suffixes can be recorded consistently, and work with certain priorities that are very well described in the official Guidline Google. I found a translation for you Resource Review

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions