SearchView

(SESL modified) A widget that provides a user interface for entering search queries and submitting requests to a search provider, fully adapted for Samsung One UI.

  • Background Blur Support: Implements BlurSupportable for rendering One UI 8.5 background blur effects on getBlurTargetView (the search plate), configured dynamically via setBlurMode, applyBlurInfo, and clearBlurInfo.
  • SVoice &Voice Search Integration: Native support for Samsung SVoice (SVI) speech recognition and Google Voice Input (GVI) search intents and voice button dispatch.
  • Up &Overflow Navigation Buttons: Integrated up/back button (seslSetOnUpButtonClickListener) and overflow menu button (seslSetOnOverflowMenuButtonClickListener) for toolbar action view layouts.
  • Typography &Styling: Adapts search query font weights (semibold) and search plate corner radii to match One UI design guidelines.
  • Haptic Feedback: Provides subtle haptic feedback for search button interactions.

When the SearchView is used in an ActionBar as an action view, it's collapsed by default, so you must provide an icon for the action.

If you want the search field to always be visible, then call setIconifiedByDefault(false).

See also

Constructors

Link copied to clipboard
constructor(@NonNull context: @NonNull Context)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet, defStyleAttr: Int)

Types

Link copied to clipboard
interface OnCloseListener
Link copied to clipboard
Link copied to clipboard
Callbacks for changes to the query text.
Link copied to clipboard
Callback interface for selection events on suggestions.
Link copied to clipboard
Local subclass for AutoCompleteTextView.
Link copied to clipboard
Style configuration enum for SearchView text, hint, and icon colors based on theme and background presence.

Properties

Link copied to clipboard
val FLAG_MUTABLE: Int = 33554432

Functions

Link copied to clipboard
open fun applyBlurInfo(@NonNull context: @NonNull Context): Boolean
Applies blur info using the given context.
Link copied to clipboard
open fun clearBlurInfo(@NonNull context: @NonNull Context)
Clears blur info using the given context.
Link copied to clipboard
open fun clearFocus()
Link copied to clipboard
@Nullable
open fun getBlurTargetView(): @Nullable View
Returns the target view for applying blur effects (the search plate).
Link copied to clipboard
open fun getImeOptions(): Int
Returns the IME options set on the query text field.
Link copied to clipboard
open fun getInputType(): Int
Returns the input type set on the query text field.
Link copied to clipboard
open fun getMaxWidth(): Int
Gets the specified maximum width in pixels, if set.
Link copied to clipboard
Returns the query string currently in the text field.
Link copied to clipboard
@Nullable
open fun getQueryHint(): @Nullable CharSequence
Returns the hint text that will be displayed in the query text field.
Link copied to clipboard
Returns the adapter used for suggestions, if any.
Link copied to clipboard
Checks if blur is currently applied to the search plate.
Link copied to clipboard
Returns the default iconified state of the search field.
Link copied to clipboard
open fun isIconified(): Boolean
Returns the current iconified state of the SearchView.
Link copied to clipboard
Returns whether query refinement is enabled for all items or only specific ones.
Link copied to clipboard
Returns whether the submit button is enabled when necessary or never displayed.
Link copied to clipboard
Called when this view is collapsed as an action view.
Link copied to clipboard
Called when this view is expanded as an action view.
Link copied to clipboard
open fun onWindowFocusChanged(hasWindowFocus: Boolean)
Link copied to clipboard
Link copied to clipboard
open fun requestFocus(direction: Int, previouslyFocusedRect: Rect): Boolean
Link copied to clipboard
Returns the auto-complete text view used for query input.
Link copied to clipboard
Returns the overflow menu button view.
Link copied to clipboard
Returns the up (back) navigation button view.
Link copied to clipboard
Returns whether Samsung Voice Input (SVI) is enabled for voice search.
Link copied to clipboard
Sets whether to suppress displaying the soft keyboard automatically when the search view is focused.
Link copied to clipboard
Sets a click listener for the overflow menu button.
Link copied to clipboard
Sets a listener to receive private IME commands sent to the search query text field.
Link copied to clipboard
Sets a click listener for the up navigation button.
Link copied to clipboard
Sets the icon drawable for the overflow menu button.
Link copied to clipboard
Sets the visibility of the overflow menu button.
Link copied to clipboard
open fun seslSetSearchMagIconVisibility(visibility: Int)
Sets the visibility of the search magnifier icon button.
Link copied to clipboard
open fun seslSetSviEnabled(enabled: Boolean): Boolean
Enables or disables Samsung Voice Input (SVI) for voice search queries.
Link copied to clipboard
open fun seslSetUpButtonIcon(drawable: Drawable)
Sets the icon drawable for the up navigation button.
Link copied to clipboard
open fun seslSetUpButtonVisibility(visibility: Int)
Sets the visibility of the up navigation button.
Link copied to clipboard
open fun setAppSearchData(appSearchData: Bundle)
Sets the APP_DATA for legacy SearchDialog use.
Link copied to clipboard
open fun setBackground(background: Drawable)
Link copied to clipboard
open fun setBackgroundResource(resid: Int)
Link copied to clipboard
open fun setBlurMode(semBlurInfoMode: Int)
Sets the blur mode integer.
Link copied to clipboard
open fun setElevation(elevation: Float)
Link copied to clipboard
open fun setIconified(iconify: Boolean)
Iconifies or expands the SearchView.
Link copied to clipboard
open fun setIconifiedByDefault(iconified: Boolean)
Sets the default or resting state of the search field.
Link copied to clipboard
open fun setImeOptions(imeOptions: Int)
Sets the IME options on the query text field.
Link copied to clipboard
open fun setInputType(inputType: Int)
Sets the input type on the query text field.
Link copied to clipboard
open fun setMaxWidth(maxpixels: Int)
Makes the view at most this many pixels wide maxWidth
Link copied to clipboard
Sets a listener to inform when the user closes the SearchView.
Link copied to clipboard
Sets a listener to inform when the focus of the query text field changes.
Link copied to clipboard
Sets a listener for user actions within the SearchView.
Link copied to clipboard
Sets a listener to inform when the search button is pressed.
Link copied to clipboard
Sets a listener to inform when a suggestion is focused or clicked.
Link copied to clipboard
open fun setQuery(query: CharSequence, submit: Boolean)
Sets a query string in the text field and optionally submits the query as well.
Link copied to clipboard
open fun setQueryHint(@Nullable hint: @Nullable CharSequence)
Sets the hint text to display in the query text field.
Link copied to clipboard
Specifies if a query refinement button should be displayed alongside each suggestion or if it should depend on the flags set in the individual items retrieved from the suggestions provider.
Link copied to clipboard
open fun setSearchableInfo(searchable: SearchableInfo)
Sets the SearchableInfo for this SearchView.
Link copied to clipboard
open fun setSubmitButtonEnabled(enabled: Boolean)
Enables showing a submit button when the query is non-empty.
Link copied to clipboard
You can set a custom adapter if you wish.