Skip to content

Most visited

Recently visited

navigation

BrowseFrameLayout

public class BrowseFrameLayout
extends FrameLayout

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.v17.leanback.widget.BrowseFrameLayout


A ViewGroup for managing focus behavior between overlapping views.

Summary

Nested classes

interface BrowseFrameLayout.OnChildFocusListener

Interface for managing child focus in a BrowseFrameLayout. 

interface BrowseFrameLayout.OnFocusSearchListener

Interface for selecting a focused view in a BrowseFrameLayout when the system focus finder couldn't find a view to focus. 

Inherited XML attributes

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

BrowseFrameLayout(Context context)
BrowseFrameLayout(Context context, AttributeSet attrs)
BrowseFrameLayout(Context context, AttributeSet attrs, int defStyle)

Public methods

boolean dispatchKeyEvent(KeyEvent event)

Dispatch a key event to the next view on the focus path.

View focusSearch(View focused, int direction)

Find the nearest view in the specified direction that wants to take focus.

BrowseFrameLayout.OnChildFocusListener getOnChildFocusListener()

Returns the BrowseFrameLayout.OnChildFocusListener.

BrowseFrameLayout.OnFocusSearchListener getOnFocusSearchListener()

Returns the BrowseFrameLayout.OnFocusSearchListener.

void requestChildFocus(View child, View focused)

Called when a child of this parent wants focus

void setOnChildFocusListener(BrowseFrameLayout.OnChildFocusListener listener)

Sets a BrowseFrameLayout.OnChildFocusListener.

void setOnDispatchKeyListener(View.OnKeyListener listener)

Sets the View.OnKeyListener on this view.

void setOnFocusSearchListener(BrowseFrameLayout.OnFocusSearchListener listener)

Sets a BrowseFrameLayout.OnFocusSearchListener.

Protected methods

boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect)

Look for a descendant to call requestFocus() on.

Inherited methods

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

BrowseFrameLayout

added in version 22.1.0
BrowseFrameLayout (Context context)

Parameters
context Context

BrowseFrameLayout

added in version 22.1.0
BrowseFrameLayout (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

BrowseFrameLayout

added in version 22.1.0
BrowseFrameLayout (Context context, 
                AttributeSet attrs, 
                int defStyle)

Parameters
context Context

attrs AttributeSet

defStyle int

Public methods

dispatchKeyEvent

boolean dispatchKeyEvent (KeyEvent event)

Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.

Parameters
event KeyEvent: The key event to be dispatched.

Returns
boolean True if the event was handled, false otherwise.

focusSearch

View focusSearch (View focused, 
                int direction)

Find the nearest view in the specified direction that wants to take focus.

Parameters
focused View: The view that currently has focus

direction int: One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT, or 0 for not applicable.

Returns
View

getOnChildFocusListener

added in version 22.1.0
BrowseFrameLayout.OnChildFocusListener getOnChildFocusListener ()

Returns the BrowseFrameLayout.OnChildFocusListener.

Returns
BrowseFrameLayout.OnChildFocusListener

getOnFocusSearchListener

added in version 22.1.0
BrowseFrameLayout.OnFocusSearchListener getOnFocusSearchListener ()

Returns the BrowseFrameLayout.OnFocusSearchListener.

Returns
BrowseFrameLayout.OnFocusSearchListener

requestChildFocus

void requestChildFocus (View child, 
                View focused)

Called when a child of this parent wants focus

Parameters
child View: The child of this ViewParent that wants focus. This view will contain the focused view. It is not necessarily the view that actually has focus.

focused View: The view that is a descendant of child that actually has focus

setOnChildFocusListener

added in version 22.1.0
void setOnChildFocusListener (BrowseFrameLayout.OnChildFocusListener listener)

Sets a BrowseFrameLayout.OnChildFocusListener.

Parameters
listener BrowseFrameLayout.OnChildFocusListener

setOnDispatchKeyListener

added in version 25.1.0
void setOnDispatchKeyListener (View.OnKeyListener listener)

Sets the View.OnKeyListener on this view. This listener would fire only for unhandled KeyEvents. We need to provide an external key listener to handle back button clicks when we are in full screen video mode because setOnKeyListener(OnKeyListener) doesn't fire as the focus is not on this view.

Parameters
listener View.OnKeyListener

setOnFocusSearchListener

added in version 22.1.0
void setOnFocusSearchListener (BrowseFrameLayout.OnFocusSearchListener listener)

Sets a BrowseFrameLayout.OnFocusSearchListener.

Parameters
listener BrowseFrameLayout.OnFocusSearchListener

Protected methods

onRequestFocusInDescendants

boolean onRequestFocusInDescendants (int direction, 
                Rect previouslyFocusedRect)

Look for a descendant to call requestFocus() on. Called by requestFocus(int, android.graphics.Rect) when it wants to request focus within its children. Override this to customize how your ViewGroup requests focus within its children.

Parameters
direction int: One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT

previouslyFocusedRect Rect: The rectangle (in this View's coordinate system) to give a finer grained hint about where focus is coming from. May be null if there is no hint.

Returns
boolean Whether focus was taken.

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!

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)