7

enter image description here

I am new in Android TV development.

I use android leanback library for this. Also I I use BrowseSupportFragment and RowsSupportFragmen.

Here I want to customise the HeaderItem shown in the picture.

Specially I want to change its font. I check lots of things but not getting proper solution for this.

Thank You.

sohel.eco
  • 337
  • 2
  • 12

2 Answers2

2

If you use BrowseSupportFragment you can use method setHeaderPresenterSelector() and register own presenter for headers. It should inherard from RowHeaderPresenter

If you want to override all header at once then you can create file res/values/layout/lb_row_header.xml and redefine layout for default header presenter.

LunaVulpo
  • 3,043
  • 5
  • 30
  • 58
  • 4
    I think setHeaderPresenterSelector is for left side drawer header not for this one which i mention in the question. – sohel.eco Sep 30 '19 at 05:25
  • 2
    Here I am Using RowsSupportFragment – sohel.eco Sep 30 '19 at 07:02
  • Yes setHeaderPresenterSelector is for left side drawer. – Harish Jan 01 '20 at 11:57
  • @sohel.eco i've you got any solution for this, I'm also looking for that solution – Harish Jan 01 '20 at 11:59
  • @Harish I did lots of r&d about that but not got any solution. Also one thing I see in TV app development, in all cases of TV development apps there is no customisation. Leanback library give lots of functionalities as it is default and less customisation is available in that – sohel.eco Jan 02 '20 at 08:09
  • @sohel.eco, I've followed, this link and achieved the text with icon..https://stackoverflow.com/questions/46198605/androidtv-change-color-of-rows-header-browsefragment and also in this below URL they told how to change the text font also https://stackoverflow.com/questions/41780279/android-tv-how-to-change-color-of-title-and-color-of-headeritem font i didn't try. – Harish Jan 07 '20 at 09:09
  • Hi Guys, i am new to android leanback, anybody has an idea, that how to stop header(left side) animation in browse fragment ? – ch3tanz Apr 01 '20 at 07:59
1

Try this:

 override fun onBindRowViewHolder(holder: RowPresenter.ViewHolder?, item: Any?) {
    super.onBindRowViewHolder(holder, item)
    val textView = holder?.headerViewHolder?.view?.findViewById<RowHeaderView>(R.id.row_header)
    textView?.run {
        setTextColor(Color.WHITE)
        setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.5f)
        isAllCaps = true
        setFontFamily(context, R.font.hind_bold)
    }
 }
Neil Turner
  • 2,712
  • 2
  • 18
  • 37
Ashik Azeez
  • 404
  • 5
  • 8