Android TV Leanback Text Color

Does anyone know how I can change the title of the textcolor from the Leanback ImageCardView ???

I tried to override the leanback style, but I may not have found the correct attribute.

Thank you very much.

+3


source to share


3 answers


You can change the text color of the ImageCardView like this:



// 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);
}

      

+3


source


Look for the correct id in lb_image_card_view.xml, for example here: https://github.com/kingargyle/adt-leanback-support/blob/master/leanback-v17/res/layout/lb_image_card_view.xml



+2


source


you can customize ImageCardView what you want CustomImageCardView extends BaseCardView

0


source







All Articles