Android 12 Developer Preview is here! Try it out, and give us your feedback!

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(@ColorInt color: Int, @ColorInt 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

@ColorInt 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