Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

TitleView

open class TitleView : FrameLayout, TitleViewAdapter.Provider
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ androidx.leanback.widget.TitleView

Title view for a leanback fragment.

Summary

Public constructors

<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods

open Unit

Enables or disables any view animations.

open Drawable!

Returns the badge drawable.

open SearchOrbView.Colors!

Returns the SearchOrbView.Colors used to draw the search affordance.

open View!

Returns the view for the search affordance.

open CharSequence!

Returns the title text.

open TitleViewAdapter!

open Unit

Sets the badge drawable.

open Unit

Sets the listener to be called when the search affordance is clicked.

open Unit

Sets the SearchOrbView.Colors used to draw the search affordance.

open Unit
setTitle(titleText: CharSequence!)

Sets the title text.

open Unit

Based on the flag, it updates the visibility of the individual components - BadgeView, TextView and SearchView.

Public constructors

<init>

TitleView(context: Context!)

<init>

TitleView(context: Context!, attrs: AttributeSet!)

<init>

TitleView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods

enableAnimation

open fun enableAnimation(enable: Boolean): Unit

Enables or disables any view animations.

getBadgeDrawable

open fun getBadgeDrawable(): Drawable!

Returns the badge drawable.

getSearchAffordanceColors

open fun getSearchAffordanceColors(): SearchOrbView.Colors!

Returns the SearchOrbView.Colors used to draw the search affordance.

getSearchAffordanceView

open fun getSearchAffordanceView(): View!

Returns the view for the search affordance.

getTitle

open fun getTitle(): CharSequence!

Returns the title text.

getTitleViewAdapter

open fun getTitleViewAdapter(): TitleViewAdapter!

setBadgeDrawable

open fun setBadgeDrawable(drawable: Drawable!): Unit

Sets the badge drawable. If non-null, the drawable is displayed instead of the title text.

setOnSearchClickedListener

open fun setOnSearchClickedListener(listener: OnClickListener!): Unit

Sets the listener to be called when the search affordance is clicked.

setSearchAffordanceColors

open fun setSearchAffordanceColors(colors: SearchOrbView.Colors!): Unit

Sets the SearchOrbView.Colors used to draw the search affordance.

setTitle

open fun setTitle(titleText: CharSequence!): Unit

Sets the title text.

updateComponentsVisibility

open fun updateComponentsVisibility(flags: Int): Unit

Based on the flag, it updates the visibility of the individual components - BadgeView, TextView and SearchView.

Parameters
flags Int: integer representing the visibility of TitleView components.