当前位置: 动力学知识库 > 问答 > 编程问答 >

Android Studio Dinamically add a new Section

问题描述:

I'm a beginner in Android development and I'm stucked in a way to dinamically add or remove a new Section.

The image below shows the way I want to do it. If I press the + button then a new item is created and I can insert the info about the item. If i press the - button then it will delete the item.

I don't want to make the items to be fixed. I need the user to insert as many items as they want to.

网友答案:

For dynamic views I suggest RecyclerView, which is more flexible than ListView and provide basic animations by default (proper calls on adapter - notifyItemInserted, notifyItemRemoved).

Here is an example.

分享给朋友:
您可能感兴趣的文章:
随机阅读: