public class BrandedSupportFragment
extends Fragment
| java.lang.Object | ||
| android.support.v4.app.Fragment | ||
| android.support.v17.leanback.app.BrandedSupportFragment | ||
| |
| |
使用实现 TitleViewAdapter.Provider的视图管理搜索和品牌的片段类。
Public constructors |
|
|---|---|
BrandedSupportFragment() |
|
继承方法(Inherited methods) |
|
|---|---|
android.support.v4.app.Fragment
|
|
java.lang.Object
|
|
android.content.ComponentCallbacks
|
|
android.view.View.OnCreateContextMenuListener
|
|
BrandedSupportFragment ()
Drawable getBadgeDrawable ()
返回片段标题中使用的可绘制徽章。
| 返回(Returns) | |
|---|---|
Drawable |
The badge drawable used in the fragment title. |
int getSearchAffordanceColor ()
返回用于绘制搜索示范的颜色。
| 返回(Returns) | |
|---|---|
int |
|
SearchOrbView.Colors getSearchAffordanceColors ()
返回用于绘制搜索示能表示的 SearchOrbView.Colors 。
| 返回(Returns) | |
|---|---|
SearchOrbView.Colors |
|
View getTitleView ()
返回实现 TitleViewAdapter.Provider的视图。
| 返回(Returns) | |
|---|---|
View |
The view that implements TitleViewAdapter.Provider. |
TitleViewAdapter getTitleViewAdapter ()
返回标题视图实现的 TitleViewAdapter 。
| 返回(Returns) | |
|---|---|
TitleViewAdapter |
The TitleViewAdapter implemented by title view. |
void installTitleView (LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
膨胀标题视图并添加到父项。 该方法应在onCreateView(LayoutInflater, ViewGroup, Bundle)中onCreateView(LayoutInflater, ViewGroup, Bundle) 。
| 参数(Parameters) | |
|---|---|
inflater |
LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment, |
parent |
ViewGroup: Parent of title view. |
savedInstanceState |
Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here. |
boolean isShowingTitle ()
返回true / false以指示TitleView的可见性。
| 返回(Returns) | |
|---|---|
boolean |
boolean to indicate whether or not it's showing the title. |
void onDestroyView ()
当先前由onCreateView(LayoutInflater, ViewGroup, Bundle)创建的视图已从片段中分离时调用。 下次需要显示片段时,将创建一个新视图。 这是在onStop()之后和onDestroy()之前onDestroy() 。 无论它被称为onCreateView(LayoutInflater, ViewGroup, Bundle)返回一个非空的观点。 内部它在视图的状态被保存之后但在它的父对象被移除之前被调用。
View onInflateTitleView (LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
由installTitleView(LayoutInflater, ViewGroup, Bundle)调用来夸大标题视图。 默认实现使用布局文件lb_browse_title。 子类可以覆盖并使用其自己的布局,该布局必须具有实现TitleViewAdapter.Provider具有id browse_title_group的后代。 如果不需要标题,子类可能会返回null。
| 参数(Parameters) | |
|---|---|
inflater |
LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment, |
parent |
ViewGroup: Parent of title view. |
savedInstanceState |
Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here. |
| 返回(Returns) | |
|---|---|
View |
Title view which must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider, or null for no title view. |
void onSaveInstanceState (Bundle outState)
打电话询问片段以保存其当前的动态状态,以便稍后可以在重新启动其进程的新实例时重新构建它。 如果片段的新实例后需要创建,您的包放在这里的数据将提供给包可onCreate(Bundle) , onCreateView(LayoutInflater, ViewGroup, Bundle) ,并onActivityCreated(Bundle) 。
这对应于Activity.onSaveInstanceState(Bundle) ,其中的大部分讨论也适用于此。 但请注意: 此方法可能在onDestroy()之前onDestroy() 。 有很多情况下,碎片可能大部分被拆除(例如,当放置在背堆栈上而没有UI显示时),但是它的状态不会被保存直到其拥有的活动实际上需要保存其状态。
| 参数(Parameters) | |
|---|---|
outState |
Bundle: Bundle in which to place your saved state. |
void onViewCreated (View view, Bundle savedInstanceState)
在onCreateView(LayoutInflater, ViewGroup, Bundle)已返回之后立即调用,但在任何已保存的状态已恢复到视图之前。 这让子类有机会在知道其视图层次已完全创建后自行初始化。 此时片段的视图层次不会附加到其父项。
| 参数(Parameters) | |
|---|---|
view |
View: The View returned by onCreateView(LayoutInflater, ViewGroup, Bundle). |
savedInstanceState |
Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here. |
void setBadgeDrawable (Drawable drawable)
设置片段标题中显示的绘图。
| 参数(Parameters) | |
|---|---|
drawable |
Drawable: The Drawable to display in the fragment title. |
void setOnSearchClickedListener (View.OnClickListener listener)
为搜索可供性设置点击侦听器。
侦听器的存在会改变片段标题中搜索示能表的可见性。 当设置为非null时,标题将包含用户可以单击以开始搜索的元素。
监听器的 onClick方法将在用户点击搜索元素时被调用。
| 参数(Parameters) | |
|---|---|
listener |
View.OnClickListener: The listener to call when the search element is clicked. |
void setSearchAffordanceColor (int color)
设置用于绘制搜索示范的颜色。 默认的更亮的颜色将由框架设置。
| 参数(Parameters) | |
|---|---|
color |
int: The color to use for the search affordance. |
void setSearchAffordanceColors (SearchOrbView.Colors colors)
设置用于绘制搜索 SearchOrbView.Colors 。
| 参数(Parameters) | |
|---|---|
colors |
SearchOrbView.Colors: Colors used to draw search affordance. |
void setTitle (CharSequence title)
设置片段的标题文本。
| 参数(Parameters) | |
|---|---|
title |
CharSequence: The title text of the fragment. |
void setTitleView (View titleView)
设置实现 TitleViewAdapter的视图。
| 参数(Parameters) | |
|---|---|
titleView |
View: The view that implemented TitleViewAdapter.Provider. |
void showTitle (int flags)
更改标题视图的组件可见性并显示标题。
| 参数(Parameters) | |
|---|---|
flags |
int: Flags representing the visibility of components inside title view. |
void showTitle (boolean show)
显示或隐藏标题视图。
| 参数(Parameters) | |
|---|---|
show |
boolean: True to show title view, false to hide title view. |