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

SearchOrbView

open class SearchOrbView : FrameLayout, OnClickListener
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ androidx.leanback.widget.SearchOrbView

A widget that draws a search affordance, represented by a round background and an icon.

The background color and icon can be customized.

Summary

Nested classes

open

A set of colors used to display the search orb.

Public constructors

<init>(context: Context!)

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

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

Public methods

open Unit

Enables or disables the orb color animation.

open Int

Returns the orb color

open SearchOrbView.Colors!

Returns the Colors used to display the search orb.

open Drawable!

Returns the orb icon

open Unit
onClick(view: View!)

open Unit

Sets the on click listener for the orb.

open Unit
setOrbColor(color: Int)

Sets the background color of the search orb.

open Unit
setOrbColor(color: Int, brightColor: Int)

Sets the search orb colors.

open Unit

Sets the Colors used to display the search orb.

open Unit

Sets the orb icon.

Protected methods

open Unit

open Unit

open Unit
onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: Rect!)

Public constructors

<init>

SearchOrbView(context: Context!)

<init>

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

<init>

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

Public methods

enableOrbColorAnimation

open fun enableOrbColorAnimation(enable: Boolean): Unit

Enables or disables the orb color animation.

Orb color animation is handled automatically when the orb is focused/unfocused, however, an app may choose to override the current animation state, for example when an activity is paused.

getOrbColor

open fun getOrbColor(): Int

Returns the orb color

Return
Int: the RGBA color

getOrbColors

open fun getOrbColors(): SearchOrbView.Colors!

Returns the Colors used to display the search orb.

getOrbIcon

open fun getOrbIcon(): Drawable!

Returns the orb icon

Return
Drawable!: the drawable used as the icon

onClick

open fun onClick(view: View!): Unit

setOnOrbClickedListener

open fun setOnOrbClickedListener(listener: OnClickListener!): Unit

Sets the on click listener for the orb.

Parameters
listener OnClickListener!: The listener.

setOrbColor

open fun setOrbColor(color: Int): Unit

Sets the background color of the search orb. Other colors will be provided by the framework.

Parameters
color Int: the RGBA color

setOrbColor

open fun setOrbColor(color: Int, brightColor: Int): Unit

Deprecated: Use setOrbColors(Colors) instead.

Sets the search orb colors. Other colors are provided by the framework.

setOrbColors

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

Sets the Colors used to display the search orb.

setOrbIcon

open fun setOrbIcon(icon: Drawable!): Unit

Sets the orb icon.

Parameters
icon Drawable!: the drawable to be used as the icon

Protected methods

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onDetachedFromWindow

protected open fun onDetachedFromWindow(): Unit

onFocusChanged

protected open fun onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: Rect!): Unit