I am creating an application, where a specific layout gets added on a particular event say on a button click. Actually i am confused that whether i should use list view for doing this or just add views inside the parent layout programmatically. The layout consist of an edit-Text,a deletion button and a check-box. Deletion button will remove the layout, so considering all these things which way i should prefer. Any help would be appriciated
If you are using edittext , button in your layout then i would suggest to add this layout programatically inside any of your parent layout. Because with list you will might face several issues like with view reusability in list, will create redundancy in your edit text content, focusability issue on button or list click. And with the other method, i guess you only need to maintain a list of your views. Hope this will help you :)
If your parent layout is a ScrollView or has capability of scrolling then, do not use ListView.
Step 1: My suggestion is, if parent layout do not have capability of scrolling, then add a scrollView.
Step 2: Create an xml of three views you want to add.
Step 3: Inflate views (from xml) and add/remove it programmatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With