Khawar Raza
Khawar Raza

Reputation: 16120

Use a ListView, or inflate and add views manually?

Which method is better? 1) Using a listview 2) Inflating and adding views in somelayout manually

Upvotes: 1

Views: 627

Answers (4)

Nandagopal T
Nandagopal T

Reputation: 2037

If you need your list to be customized or to have different look and feel than the android inbuilt list, then you can go for inflating and adding views in some layout manually. But efficiency wise , you can go with inbuilt one.

This is help you to know the things more better.

http://www.technotalkative.com/category/android/listview/

Upvotes: 0

Martin Stam
Martin Stam

Reputation: 84

IMO: Use a listview.

Because 1) Listviews are standardised Android UI elements. They are recogniced by users as such, and used by developers that know how to use them. If any of them then has to maintain your code, (s)he'll thank you.

2) With some personal experience: Down the road of doing this manually: Lies pain and madness of the worst sort. Just use the tools avilable and save yourself the headache. ;-)

Upvotes: 1

Rajdeep Dua
Rajdeep Dua

Reputation: 11230

It depends on the use case, though adding views dynamically is going to be slower, also avoid deeper layout hierarchies. For list view use ViewHolder to hold the views.

Upvotes: 0

oriolpons
oriolpons

Reputation: 1883

It deppends on what you want to do...

If your layout will be like a listview, make a listview with your custom adapters, more optimal and fast ;)

Upvotes: 1

Related Questions