Search code examples
androidleanback

How can I add a background image to navigation row in browse fragment?


enter image description here

So basically here in the left menu row I want to set a custom image i.e. the whole blue thing in background in menu a custom image has to come.In leanback they give us the api set brand color to set color but nothing to set image .Is there any way to achieve this? Thanx in advance


Solution

  • If you are talking about navigation drawer of design support library then this is how you do it :

    //you basically create a layout with a background image and other views
    navigationView.inflateHeaderView(R.layout.drawer_header)
    

    [Edit] Try something like this for leanback:

    HeasdersFragment hf = browseFragment.getHeadersFragment();
    hf.getView().setBackgroundResource()