8

I am working on an android TV app and I am using the leanback library.

I want to customize the app layout "BrowseFragment". I want to remove the header view and only display the card list "rows".

Is it possible to do that or is there any other solution to achieve that?

I want to remove that

Billel Boumessaidia
  • 211
  • 1
  • 3
  • 11

4 Answers4

11

The above call actually needs to be in the OnCreate method instead of OnActivityCreated.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHeadersState(HEADERS_DISABLED);
}
ebr
  • 323
  • 3
  • 10
4

You have to set the HeaderState like this:

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setHeadersState(HEADERS_DISABLED); // Add this line
}
Sofiane Daoud
  • 868
  • 9
  • 21
1

There are two options:

/** The headers fragment is enabled and hidden by default. */

HEADERS_HIDDEN

/** The headers fragment is disabled and will never be shown. */

HEADERS_DISABLED

OnCreate, you have to set the Header:

    setHeadersState(HEADERS_DISABLED); //To Diable the Header

    setHeadersState(HEADERS_HIDDEN); //To Hide the Header
Ranjith
  • 41
  • 5
0

When you change the setHeaderState(HEADERS_DISABLED), the rows would be disabled and hidden too. One way to do it is setHeaderPresenterSelector()

private void setupUIElements() {

    setHeadersState(HEADERS_DISABLED);

    setHeaderPresenterSelector(new PresenterSelector() {
        @Override
        public Presenter getPresenter(Object item) {
            return new CustomPresenter();
        }
    });
}

you just need to override the getPresenter() method, and return new customized presenter that you need to implement.