Android Add Contact Form dynamically

2020-07-22 17:37发布

问题:

Hi,

I want to implement form like in the image, dont have idea how they are adding Fields dynamically. Is this a ListView? Expandable List? user can add and remove at runtime. I have checked Expandable List which contains child items. but we define child in array, In the image they add dynamically.

Any guide/link

Thanks

回答1:

Custom ListView Adapters are often back by Collections, like List, ArrayList, etc. These lists may contain your custom objects, where the Adapter determines what to display based on the object properties. The lists can be managed/altered in typical fashions, like add() remove(), etc.

Do a Google search for "android custom list adapters" to learn more.

Here is an example of dynamically creating list rows with a "plus" buttons to add more rows. Should give you a good start: Dynamically add elements to a listView Android

You can always look at the source of the Android contacts app, as well.