android - Setting list item background color loses highlighting -


I have created an inbox activity and I am mirroring some of the default mail applications that come with Android.

In the mail, the background color of a message that has not been read is a slight color compared to the rest of the list. I have reflected it by calling the setBackgroundResource in my adapter's getView method, SetBackgroundColor does nothing.

  if (! MsgSum.getIsRead ()) {LinearLayout l = (LinearLayout) v.findViewById (R.id.inbox_background); If (l! = Null) {l.setBackgroundResource (R.color.inbox_unread); }} And {LinearLayout l = (LinearLayout) v.findViewById (R.id.inbox_background); If (L! = Null) {l.setBackgroundResource (R.color.inbox_read); }}  

The problem is, the items lose the ability to highlight again. What do I mean, usually if you scroll your mouse wheel with the emulator (or if you have some scrolling capabilities in your Android device), the list item will be as yellow as they focus.

<

Thank you for your help

The reason is that the list item Highlight is created behind you need to prepare a state list for the background of your item which sets the background color transparent in the selected state. If you talk about the list of inventory listed on Google I / O 2010 If so, you'll get an example of how to do this.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -