7

In my TV App, I need to implement the fixed Header in BrowseFragment like Youtube App. Below I have attached the screenshot how I want.

enter image description here

I'm implemented purely with Lean Back, my fragment is extended with browsefragment and I'm able to add icon and text to my header item.

Like below link they explained:

https://corochann.com/browsefragment-header-customization-android-tv-application-hands-on-tutorial-17-697.html

when focus moves to the right side, my header is collapsing fully. In my case, I want to collapse the header into little and need to show only icons in the header.

halfer
  • 19,824
  • 17
  • 99
  • 186
Harish
  • 237
  • 2
  • 10
  • What have you tried so far? How much research have you done so far? And where's the problem? That is simple `XML`, isn't that? – letsintegreat Jan 22 '19 at 12:55
  • No, I'm using purely lean back, My fragment is extended with BrowseFragment , I'm able to add the icon and text, but when my focus went to the right side rows. Header fragment is collapsing. But in my case its as to collapse little and as it show icons like youtube – Harish Jan 22 '19 at 13:05
  • I think that catalog browser is part of Youtube Web UI component. Catalog Browser or Browse lane (the `BrowseFragment`) in Android TV Leanback doesn't have such half-way hiding the catalog browser by only showing the icons after navigating into the rows on the right side... Its `BrowseFragment.setHeadersState()` are just in three states...Probably you need to see the source code and extends the BrowserFragment by adding the "new" state and manage its transitions. https://developer.android.com/training/tv/playback/browse#hide-heads – ecle Feb 02 '19 at 11:56
  • 2
    Hello. Did you ever find a solution to this? I have similar requirements. – ninjachippie Jun 24 '19 at 11:58
  • No I didn't find it. – Harish Sep 12 '19 at 09:07
  • You can change headers behavior by overriding `startHeadersTransition` of `BrowseFragment`. `startHeadersTransitionInternal` and `createHeadersTransition` are responsible for changing headers in case of a transition. – mahdi Mar 26 '20 at 11:14

1 Answers1

4

This type of functionality is not supported in Leanback. And I too searched the solution for it everywhere but didn't find anything useful. So I ended up writing a Fragment that behaves like the sidebar navigation and works with RowsSupportFragment through an interface for exchanging KeyPad Events.

When in Expanded State -> Menu Icon & Menu Names are shown.

When in Collapsed State -> Menu Icons are shown.

Navigation Collapsed state

Check out this Repository

Arpit J.
  • 1,108
  • 12
  • 20