In the getView method of the adapter, use the index of the row to set
background to. Suppose every row is a textView, then
textView.setBackgroundColor(Color.BLACK) would do the trick.
For different indices, you could do this...
public View getView(int index, View convertView, ViewGroup parent) {
textView.setText(....)
...
...
if(index %2 == 0){
textView.setBackgroundColor(Color.BLACK);
}else{
textView.setBackgroundColor(Color.BLUE);
}
return textView;
}
Something like that I guess is what you are looking for. Hope that helps
On Mon, Apr 9, 2012 at 1:30 PM, Put_tiMe <[email protected]> wrote:
> I want to add a background image for each row of a list-view control.
> I have written a custom adapter for the list view.
>
> What is the best way of doing it?
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en