Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom your ImageCardView style ( not the content )

How can I custom the ImageCardView to be circular in Leanback?

like image 234
ArolaAb Avatar asked Mar 14 '17 15:03

ArolaAb


1 Answers

There are few ways you could do this. I think the cleaner approach would be creating your own custom CardView which extends BaseCardView. Then you could create your own CardPresenter which is capable of presenting that circular card type.

The leanback showcase sample app goes into great detail about customizing cards. I'd suggest looking at all of it but the relevant part would be their custom CharacterCardView. Which has it's entirely own custom layout. And then it has it's own CharacterCardPresenter. I'd copy the code right into here but those classes links will do much better justice.

The alternative is to override lb_image_card_view.xml and replace it with your own circular view. As long as you keep the resource ids and the view types the same, you could maybe get away with styling it how you like. ImageCardView is also highly styleable which you can read about in the ImageCardView docs.

like image 91
Kyle Venn Avatar answered Nov 01 '22 08:11

Kyle Venn