Hey all I am trying to figure out how to change the background color of the items that are not currently in focus in my Leanback app:
The selected row has the transparent color so that only the box art is showing. However, the issue is the row that is not selected. It still seems to have a dark grey background instead of what I am wanting, transparent.
I've looked around my code and this is the code that looks to currently change the background when I select a box art item:
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
sDefaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.default_background);
sSelectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.selected_background);
mDefaultCardImage = ContextCompat.getDrawable(parent.getContext(), R.drawable.movie);
ImageCardView cardView =
new ImageCardView(parent.getContext()) {
@Override
public void setSelected(boolean selected) {
updateCardBackgroundColor(this, selected);
super.setSelected(selected);
}
};
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
updateCardBackgroundColor(cardView, false);
return new ViewHolder(cardView);
}
The sDefaultBackgroundColor is transparent and this is what's used for the focused row.
The sSelectedBackgroundColor is an orange color to indicate that an item in the row has focus.
The mDefaultCardImage is a placeholder for box art that is not currently there.
So these are the only ones I have found in my code that changes the color of the cards.
Anyone know what the code is for the non-focused row/box art?