Android View setBackgroundColor not working in custom CursorAdapter -
i have android list activity custom cursor adapter retrieves items db. it's supposed set text of view retrieved item's name, , set background item's set color, stored in db integer. name being set expected, color not changing. here code:
@override public void bindview(view view, context context, cursor cursor) { textview colorname = (textview) view.findviewbyid(r.id.color_desc); colorname.settext(cursor.getstring(cursor.getcolumnindex(thread_desc))); view.setbackgroundcolor(cursor.getint(cursor.getcolumnindex(thread_color))); } the views in list show correct color name, white background. tried setting color preset java colors, , views still end white. changing view.setbackgroundcolor colorname.setbackgroundcolor didn't change anything. tried putting logging statements before call setbackgroundcolor, , appears color integers being retrieved. believe device i'm using test running api 19. did miss?
edit: after more fiddling, realized because color integers in db generated r/g/b data only, without alpha bits. calling color.argb(0xff, r, g, b) instead of color.rgb(r, g, b) seems have fixed it.
Comments
Post a Comment