W
W
Who_Is_Who2018-10-21 21:28:46
Java
Who_Is_Who, 2018-10-21 21:28:46

Programmatically creating an xml layout through a class?

How I would like to do (example):

if(условие){
    rootView = inflater.inflate(R.layout.номер_один, container, false);
} else {
    rootView = inflater.inflate(R.layout.номер_два, container, false);
}

But only without pre-prepared xml files, they should be created automatically after the condition.
About 100 xml layouts are expected, so it seems illogical to prepare them in advance.
How to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bask, 2018-10-21
@Who_Is_Who

Alternatively, use one layout, and fill it with content dynamically from the code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question