Languages

Menu
Sites
Language
ListView disabled item (row) color

Hello,

how to change color of ListView custom item when we set listView->SetItemEnabled(0, false) ?
Default it is white/gray color but i want it to be transparent.. 

Using ListAdapter::CreateItem(int index, float itemWidth) i'm creating custem CustomItem but listItemDrawingStatus is ony normal, highlighted, pressed without disabled option...

Regards

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

8 Replies
well you can do it by knowing the disabled index. This is a way around trick !! For example, if you want to set item #5 transparent then CreateItem(int index, int itemWidth){ CustomItem* pItem = new CustomItem(); ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; pItem->Construct(Dimension(listWidth, 100), style); Font font; font.Construct(FONT_STYLE_ITALIC | FONT_STYLE_BOLD, 40); EnrichedText *eText = new EnrichedText(); TextElement *txt = new TextElement(); txt->Construct("item title ....."); if (index == 5) { txt->SetTextColor(Color(0, 0, 0, 0)); //I suppose this will be transparent } else { txt->SetTextColor(Color::GetColor(COLOR_ID_BLACK)); } txt->SetFont(font); eText->Construct(Dimension(listWidth, 100)); eText->Add(*txt); pItem->AddElement(Rectangle(0, 0, listWidth, 100), ID_LIST_ITEM, *eText); eText->RemoveAll(true); delete eText; return pItem; }
Ok, I didn't understand very well. I thought you want to set the text color to transparent!
muditha murthy
I don't think you can make an individual custom item as transparent when disabled. You can provide the transparency feature to the whole list by setting a tranparent background bitmap.
Michał
Whole list is already transparent.. but when row is disabled its row is gray/white and I could not find any function to change it. I don't know if its hardcoded or what...
You can fake the behavior of disabled item don't use SetItemEnabled but when creating custom item check if the item is disabled (match the index) like this from the example above if you want to disable item 5 if (index == 5) { pItem->AddElement(Rectangle(0, 0, listWidth, 100), ID_DISABLED_LIST_ITEM, *eText); } else { pItem->AddElement(Rectangle(0, 0, listWidth, 100), ID_ENABLED_LIST_ITEM, *eText); } then in OnListViewItemStateChanged(ListView &listView, int index, int elementId, ListItemStatus status) { if (elementId == ID_ENABLED_LIST_ITEM) { // do something } else { // ignore the click } }
Jirka Prazak
Hello, I'm having a same problem but cannot use this workaround as I have slider in each list item and that needs to be disabled on all list items as long as one is active. This workaround will only change the look and feel of the items but will not disable the on/off switch like SetIetmEnabled() will. Any suggestions? In my opinion this is a bug in the framework because the white color overwrites all background. Thanks for any help -J
I don't know if you can listen when the user slides the slider and if the item is not the active one, then you set the slider back to off Maybe you should consider using ListView with CustomView LIST_ANNEX_STYLE_RADIO for single selection at a time or with CustomView LIST_ANNEX_STYLE_NORMAL and then you disable "sweeping" for non active list item. Or listItem with CustomView LIST_ANNEX_STYLE_NORMAL and you add a bitmap (like green circle for on and red circle for off) and when the user click on one item you update the color. I think you need to find "own" solution.. I don't know any way around for slider type
Michał
I'm already doing it like you said... so there is no other way.. hardcoded color... nice