Distance between RelativeLayout Android

I just add the finishing touches to my Android app. Unfortunately, I completely fit into the development without reading the documentation and building my layout using AbsoluteLayout, and it turned out that I looked awful when I downloaded the application on my phone. Now I am remaking the user interface into a RelativeLayout, and I want to put canvas blank space between my view groups in the y-direction. I am currently achieving this by delivering random TextView sentences that are the same color as my View background to make the psuedo-empty space. Is there a better way to do this because right now, when I define a specific ViewGroup to be placed below another view, it gets stuck right under the top view.

As I wrote this, it became clear to me that using indentation might be the answer ... Any other suggestions?

+4
source share
1 answer

For each view in your xml layout, you can apply android: layout_margin * where * is the top, bottom, left or right. You will also want to use dip devices so that they appear on different displays.

One thought: you can be careful using margins and indents to make them look the way you want, because phones like a droid with a higher screen than the β€œstandard” can really mess things up.

I suggest taking a look at placing frame style elements in their position using layout_alignParent * (top, bottom, etc.), and then, for example, if you have an open space window on the screen, align its corners with the wireframe elements that will be correctly positioned due to the alignment of the parent elements, and then use the helper LinearLayout, which is centered (android: gravity = "center_horizontal") for the interface buttons or something else.

+9
source

Source: https://habr.com/ru/post/1312695/


All Articles