Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TV Leanback imagecardview text color

Anybody knows how can i change title textcolor from Leanback ImageCardView ???

I have tried to override leanback style but maybe I haven't found the correct attribute.

Thank you so much!!!

like image 245
Kabuki Avatar asked Dec 26 '22 00:12

Kabuki


1 Answers

You can change the text colour of the ImageCardView as following:

// I'm assuming you're creating your ImageCardView within a Presenter
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
    final Context context = viewGroup.getContext();
    final ImageCardView imageCardView = new ImageCardView(context);
    imageCardView.setFocusable(true);
    imageCardView.setFocusableInTouchMode(true);
    ((TextView) imageCardView.findViewById(R.id.title_text)).setTextColor(TITLE_COLOR); // Title text
    ((TextView) imageCardView.findViewById(R.id.content_text)).setTextColor(DESCRIPTION_COLOR); // Description text
    return new ViewHolder(imageCardView);
}
like image 186
Tomap Avatar answered Jan 23 '23 19:01

Tomap