Kabuki
Kabuki

Reputation: 144

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!!!

Upvotes: 4

Views: 2962

Answers (3)

Evan Ngo
Evan Ngo

Reputation: 254

you can custom ImageCardView for what do you want with CustomImageCardView extends BaseCardView

Upvotes: 1

Tomap
Tomap

Reputation: 638

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

Upvotes: 7

orbitbot
orbitbot

Reputation: 768

Look for the right 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

Upvotes: 3

Related Questions