I
I
Ivan2016-05-18 22:00:05
Android
Ivan, 2016-05-18 22:00:05

One Activity three Layouts?

Good evening, I have three buttons on my Activity. Separately, I created three Layouts and now I want different Layouts to be displayed when the buttons on the Activity are pressed. What should I do? Send...
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2016-05-18
@IceJOKER

1. Для двух layout установите visibility gone, а одного оставьте, при нажатии на кнопку переключаете видимость других layout.
2. Добавляете три фрагмента
3. Три активити

R
Rou1997, 2016-05-18
@Rou1997

You can certainly replace the Layout using setContentView, as in onCreate, but these buttons will disappear, since they are also in one of the Layouts, and you also need to listen (handle events) for elements from each of the three Layouts, you want to mix all this into a bunch in one Activity class, and then get confused?
This is absurd, make three Activities, or 1 Activity with 3 buttons (buttons will only be needed in one Layout) and with 3 Fragments that are switched by buttons.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question