Skip to content

Most visited

Recently visited

navigation
added in version 24.1.0
belongs to Maven artifact com.android.support:leanback-v17:27.0.0

BrandedFragment

public class BrandedFragment
extends Fragment

java.lang.Object
   ↳ android.app.Fragment
     ↳ android.support.v17.leanback.app.BrandedFragment
Known Direct Subclasses
Known Indirect Subclasses


Fragment class for managing search and branding using a view that implements TitleViewAdapter.Provider.

Summary

Inherited constants

From interface android.content.ComponentCallbacks2

Public constructors

BrandedFragment()

Public methods

Drawable getBadgeDrawable()

Returns the badge drawable used in the fragment title.

int getSearchAffordanceColor()

Returns the color used to draw the search affordance.

SearchOrbView.Colors getSearchAffordanceColors()

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

CharSequence getTitle()

Returns the title text for the fragment.

View getTitleView()

Returns the view that implements TitleViewAdapter.Provider.

TitleViewAdapter getTitleViewAdapter()

Returns the TitleViewAdapter implemented by title view.

void installTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)

Inflate title view and add to parent.

final boolean isShowingTitle()

Returns true/false to indicate the visibility of TitleView.

void onDestroyView()
View onInflateTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)

Called by installTitleView(LayoutInflater, ViewGroup, Bundle) to inflate title view.

void onPause()
void onResume()
void onSaveInstanceState(Bundle outState)
void onStart()
void onViewCreated(View view, Bundle savedInstanceState)
void setBadgeDrawable(Drawable drawable)

Sets the drawable displayed in the fragment title.

void setOnSearchClickedListener(View.OnClickListener listener)

Sets a click listener for the search affordance.

void setSearchAffordanceColor(int color)

Sets the color used to draw the search affordance.

void setSearchAffordanceColors(SearchOrbView.Colors colors)

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

void setTitle(CharSequence title)

Sets title text for the fragment.

void setTitleView(View titleView)

Sets the view that implemented TitleViewAdapter.

void showTitle(int flags)

Changes title view's components visibility and shows title.

void showTitle(boolean show)

Shows or hides the title view.

Inherited methods

From class android.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks

Public constructors

BrandedFragment

added in version 24.1.0
BrandedFragment ()

Public methods

getBadgeDrawable

added in version 22.1.0
Drawable getBadgeDrawable ()

Returns the badge drawable used in the fragment title.

Returns
Drawable The badge drawable used in the fragment title.

getSearchAffordanceColor

added in version 24.1.0
int getSearchAffordanceColor ()

Returns the color used to draw the search affordance.

Returns
int

getSearchAffordanceColors

added in version 24.1.0
SearchOrbView.Colors getSearchAffordanceColors ()

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

Returns
SearchOrbView.Colors

getTitle

added in version 22.1.0
CharSequence getTitle ()

Returns the title text for the fragment.

Returns
CharSequence Title text for the fragment.

getTitleView

added in version 24.1.0
View getTitleView ()

Returns the view that implements TitleViewAdapter.Provider.

Returns
View The view that implements TitleViewAdapter.Provider.

getTitleViewAdapter

added in version 24.1.0
TitleViewAdapter getTitleViewAdapter ()

Returns the TitleViewAdapter implemented by title view.

Returns
TitleViewAdapter The TitleViewAdapter implemented by title view.

installTitleView

added in version 24.1.0
void installTitleView (LayoutInflater inflater, 
                ViewGroup parent, 
                Bundle savedInstanceState)

Inflate title view and add to parent. This method should be called in 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.

isShowingTitle

added in version 24.1.0
boolean isShowingTitle ()

Returns true/false to indicate the visibility of TitleView.

Returns
boolean boolean to indicate whether or not it's showing the title.

onDestroyView

void onDestroyView ()

onInflateTitleView

added in version 24.1.0
View onInflateTitleView (LayoutInflater inflater, 
                ViewGroup parent, 
                Bundle savedInstanceState)

Called by installTitleView(LayoutInflater, ViewGroup, Bundle) to inflate title view. Default implementation uses layout file lb_browse_title. Subclass may override and use its own layout, the layout must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider. Subclass may return null if no title is needed.

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.

onPause

void onPause ()

onResume

void onResume ()

onSaveInstanceState

void onSaveInstanceState (Bundle outState)

Parameters
outState Bundle

onStart

void onStart ()

onViewCreated

void onViewCreated (View view, 
                Bundle savedInstanceState)

Parameters
view View

savedInstanceState Bundle

setBadgeDrawable

added in version 22.1.0
void setBadgeDrawable (Drawable drawable)

Sets the drawable displayed in the fragment title.

Parameters
drawable Drawable: The Drawable to display in the fragment title.

setOnSearchClickedListener

added in version 24.1.0
void setOnSearchClickedListener (View.OnClickListener listener)

Sets a click listener for the search affordance.

The presence of a listener will change the visibility of the search affordance in the fragment title. When set to non-null, the title will contain an element that a user may click to begin a search.

The listener's onClick method will be invoked when the user clicks on the search element.

Parameters
listener View.OnClickListener: The listener to call when the search element is clicked.

setSearchAffordanceColor

added in version 24.1.0
void setSearchAffordanceColor (int color)

Sets the color used to draw the search affordance. A default brighter color will be set by the framework.

Parameters
color int: The color to use for the search affordance.

setSearchAffordanceColors

added in version 24.1.0
void setSearchAffordanceColors (SearchOrbView.Colors colors)

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

Parameters
colors SearchOrbView.Colors: Colors used to draw search affordance.

setTitle

added in version 24.1.0
void setTitle (CharSequence title)

Sets title text for the fragment.

Parameters
title CharSequence: The title text of the fragment.

setTitleView

added in version 24.1.0
void setTitleView (View titleView)

Sets the view that implemented TitleViewAdapter.

Parameters
titleView View: The view that implemented TitleViewAdapter.Provider.

showTitle

added in version 24.1.0
void showTitle (int flags)

Changes title view's components visibility and shows title.

Parameters
flags int: Flags representing the visibility of components inside title view.

See also:

showTitle

added in version 24.1.0
void showTitle (boolean show)

Shows or hides the title view.

Parameters
show boolean: True to show title view, false to hide title view.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)