Most visited

Recently visited

TitleViewAdapter

public abstract class TitleViewAdapter
extends Object

java.lang.Object
    android.support.v17.leanback.widget.TitleViewAdapter


该类允许定制的窗口小部件类实现TitleViewAdapter.Provider并公开TitleViewAdapter方法以包含片段(例如,BrowseFragment或DetailsFragment)。 标题视图必须有一个搜索轨道视图( getSearchAffordanceView()以便开始对齐,并且通常可以有一个品牌标记可绘制和/或标题文本对齐到结束。标记部分完全开放以进行自定义:不必为可绘制或文本。

摘要(Summary)

Nested classes

interface TitleViewAdapter.Provider

接口由一个定制的小部件类实现TitleViewAdapter

常量(Constants)

int BRANDING_VIEW_VISIBLE

int FULL_VIEW_VISIBLE

int SEARCH_VIEW_VISIBLE

Public constructors

TitleViewAdapter()

公共方法(Public methods)

Drawable getBadgeDrawable()

返回可绘制的徽章。

SearchOrbView.Colors getSearchAffordanceColors()

返回用于绘制搜索 SearchOrbView.Colors

abstract View getSearchAffordanceView()

返回搜索可供性的视图。

CharSequence getTitle()

返回标题文本。

void setAnimationEnabled(boolean enable)

启用或禁用任何视图动画。

void setBadgeDrawable(Drawable drawable)

设置可绘制的徽章。

void setOnSearchClickedListener(View.OnClickListener listener)

为搜索示功表视图设置点击侦听器。

void setSearchAffordanceColors(SearchOrbView.Colors colors)

设置用于绘制搜索示能表示的 SearchOrbView.Colors

void setTitle(CharSequence titleText)

设置标题文本。

void updateComponentsVisibility(int flags)

根据该标志,它会更新各个组件的可见性 - 品牌视图(徽章可绘制和/或标题)和搜索可供性视图。

继承方法(Inherited methods)

From class java.lang.Object

常量(Constants)

BRANDING_VIEW_VISIBLE

int BRANDING_VIEW_VISIBLE

常量值:2(0x00000002)

FULL_VIEW_VISIBLE

int FULL_VIEW_VISIBLE

常数值:6(0x00000006)

SEARCH_VIEW_VISIBLE

int SEARCH_VIEW_VISIBLE

常量值:4(0x00000004)

Public constructors

TitleViewAdapter

TitleViewAdapter ()

公共方法(Public methods)

getBadgeDrawable

Drawable getBadgeDrawable ()

返回可绘制的徽章。

返回(Returns)
Drawable The badge drawable.

getSearchAffordanceColors

SearchOrbView.Colors getSearchAffordanceColors ()

返回用于绘制搜索 SearchOrbView.Colors

返回(Returns)
SearchOrbView.Colors Colors used to draw search affordance.

getSearchAffordanceView

View getSearchAffordanceView ()

返回搜索可供性的视图。

返回(Returns)
View The view for search affordance.

getTitle

CharSequence getTitle ()

返回标题文本。

返回(Returns)
CharSequence The title text.

setAnimationEnabled

void setAnimationEnabled (boolean enable)

启用或禁用任何视图动画。 调用此方法可以节省CPU周期,例如在包含片段暂停时停止搜索视图呼吸动画。

参数(Parameters)
enable boolean: True to enable animation, false otherwise.

setBadgeDrawable

void setBadgeDrawable (Drawable drawable)

设置可绘制的徽章。 如果非null,则显示drawable而不是标题文本。

参数(Parameters)
drawable Drawable: The badge drawable to set on title view.

setOnSearchClickedListener

void setOnSearchClickedListener (View.OnClickListener listener)

为搜索示功表视图设置点击侦听器。

侦听器的存在会改变片段标题中搜索示能表的可见性。 当设置为非null时,标题将包含用户可以单击以开始搜索的元素。

监听器的 onClick方法将在用户单击搜索元素时调用。

参数(Parameters)
listener View.OnClickListener: The listener to call when the search element is clicked.

setSearchAffordanceColors

void setSearchAffordanceColors (SearchOrbView.Colors colors)

设置用于绘制搜索 SearchOrbView.Colors

参数(Parameters)
colors SearchOrbView.Colors: Colors used to draw search affordance.

setTitle

void setTitle (CharSequence titleText)

设置标题文本。

参数(Parameters)
titleText CharSequence: The text to set as title.

updateComponentsVisibility

void updateComponentsVisibility (int flags)

根据该标志,它会更新各个组件的可见性 - 品牌视图(徽章可绘制和/或标题)和搜索可供性视图。

参数(Parameters)
flags int: integer representing the visibility of TitleView components.

也可以看看:

Hooray!