tags:

views:

45

answers:

1

Hello, i am quite new to android and i was wondering how i could go about adding a listview with different images and text. What i am trying to achieve is a listview with four rows which have a different Icon? I don't know how to set that up using the xml layout provided. should i build this using different multiple linear layout or is there a better way to go about it?.. All the examples i have seen all seem to be using one particular Icon and no much detail of the xml layout. Any help will be greatly appreciated. Thank you

A: 

If you have a fixed number of rows you can just use a LinearLayout and save yourself some headache. If you need to have a dynamic number of rows then you need to make a custom adapter for your list. If you do a Google search, there are a lot of tutorials on how to do that.

CaseyB
yes. i thought so. but i was just wondering if it was a waste of resources or bad practice of UI optimisation, creating a LinearLayout for every row of ImageView and TextView in the List.
manuelJ
I agree If you have only four rows you should not use ListView, LinearLayout is enough.
Fedor
I was thinking of using the listview because i was wanted to be able to use an ItemClickListener on each rows. can it be possible to use this on the linear layout
manuelJ
Please, sorry to bother, but is there away i can make the Linearlayout have a ListView look(i mean, with the divided lines between each rows) because when i create the rows in linearlayout, they look really flat. Thank you
manuelJ