Open tva-TIS opened 5 years ago
Hi, Where I have to put below code to change the background color?
if (p_nSelectionState == SelectionState.SELECTED) { nBackgroundColorId = R.color.selected_background_color; nForegroundColorId = R.color.selected_text_color; } else if (p_nSelectionState == SelectionState.UNSELECTED) { nBackgroundColorId = R.color.unselected_header_background_color; nForegroundColorId = R.color.unselected_text_color; }
@NainalChauhan in your view holder. Please check out the TableViewSample repo.
I don't really know how far this is considered an issue by the author, but I'm gonna leave this here for anyone that struggles with setting the unselected header color too as I didn't found this documented anywhere else.
Problem Setting the
background
on the row header and column header layouts within their xmls is currently useless, as it is overwritten by the TableView frame definitions ofunselected_color
. This doesn't occur for the corner layout.Workaround/Solution The sample app solves the issue by setting the backgroundColor manually to the header background color within setSelected like this:
I did it the other way around, as I needed to set the color on cells anyway depending on their content and defined the
unselected_color
attribute of the TableView as the colors the headers should have.Change Suggestion I would suggest limiting the
unselected_color
attribute to content cells. Maybe it would be even useful to add one or two (row, column) additional attributes to set the header color within the xml of the table view.