How to put elements on top of each other in the same xml layout?

How can I have more than one button or button and text view in one place in one layout except one above the other?

I want the button to be hidden most of the time, but sometimes it will have a non-intrusive pop-up window that tells me something. The rest of the time there will be a text view that is different in size.

+2
source share
2 answers

Check out RelativeLayouts .

They use android:layout_below and android:layout_above to place elements below / above other elements.

+8
source

Use TextView.setVisibility(View.VISIBLE) or TextView.setVisibility(View.GONE) depending on your state, and you may not need to place elements on top of each other in the layout.

+3
source

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


All Articles