Create xml elements inside the activity_controller

Asked

Viewed 56 times

0

I have a program that has a dropdown with 3 options. (Option 1 has value 1, Option 2 value 2 and option 3 value 3).

Depending on the selected option, I need to create Textedits below this dropdown. Example: If I select Dropdown option 2, it creates 2 textedits. It is possible to do something like this using only java code, without mecher in xml file??

  • yes it is possible,only search how to create these view programmatically

  • But the point is. I don’t want to create the main view programmatically, and if I were going to create one to use sublayout, I think I would have to create 3 and open according to what I selected the dropdown. so I wanted to know if it has how to create only xml elements programmatically and not insert a whole new view

  • 1

    but vc will not create 3 sublayout, you will create only the element you want, as a textview, and in java no xml, look here: https://stackoverflow.com/questions/12985825/generating-edit-text-programatically-in-android

  • Puts vc ta right! kkkk. killed my question. Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.