Anyone know how to get this result?

Description:
When the ‘+’ button is clicked, another line of EditText, Spinner, EditText and Button will be displayed below the line. And lines go on adding if the user click on the ‘+’ button.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think the best would be to implement a custom
ViewGroupextending aLinearLayoutin vertical orientation.You’ll register an
OnClickListeneron the last button: if the row is the last in the list, you’ll inflate a newingredients_item.xmland add it to your view (also you’ll refresh the drawable from+to-), otherwise remove the current row.Your custom view will provide a method like
List<Ingredient> getIngredients(), so you’ll be able to pass this list to somesave()method.I pushed the demo on GitHub