Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customizing Android TV Interfaces With LeanBack Support Library

The leanback support library for Android TV projects seems like a good effort to standardize TV experiences. However, I find it a bit too rigid and restricts customization beyond minor ones like color schemes, etc.

My question: what is the best, most efficient way to customize screens such as the DetailsFragment without rewriting the key parts of the leanback framework?

Background Information

The default detail screen looks like this:

Some things I would like to be able to do:

  1. Place one or two additional views below the DetailsOverViewRow (image, title/description, action buttons) that shows extra info unique to our app's design (for instance an emoji reactions panel and movie credits panel - mostly a thumbnail image and name text view of movie creators)
  2. Correctly crop the card thumbnail image to fit entirely in its image view. The image is currently clipped, unlike in the browser screen card view where it fits into the card view nicely. The library's xml layout file defines a rather small container size (fixed height of 274dp), and that is probably why the image is not properly cropped

What I've Tried

Extend DetailsOverViewRowPresenter to be able to inflate a custom XML file that defines the additional views. Unfortunately, this class hides its key initializer method, createRowViewHolder->private initDetailsOverview(ViewHolder vh), so I would have to duplicate such hidden yet key methods, which to me defeats the point of subclassing. Is there a better way than to recreate such code? NOTE: this approach might be similar to one posted in this related question but OP didn't go into further detail.

like image 289
kip2 Avatar asked Oct 25 '25 03:10

kip2


1 Answers

I ended up not implementing the details screen. But it looks like the updated leanback library now supports some level of customization. The google-samples leanback project on github is a decent starting place. For example: VideoDetailsFragment subclasses the DetailsFragment.

Additionally, other customization possibilities discussed in this medium post are worth noting

like image 143
kip2 Avatar answered Oct 27 '25 16:10

kip2