Android Guides | Samples

Android.Widget.SearchView Class

A widget that provides a user interface for the user to enter a search query and submit a request to a search provider.

See Also: SearchView

Syntax

[Android.Runtime.Register("android/widget/SearchView", DoNotGenerateAcw=true)]
public class SearchView : LinearLayout, ICollapsibleActionView, IDisposable

Remarks

A widget that provides a user interface for the user to enter a search query and submit a request to a search provider. Shows a list of query suggestions or results, if available, and allows the user to pick a suggestion or result to launch into.

Developer Guides

When the SearchView is used in an ActionBar as an action view for a collapsible menu item, it needs to be set to iconified by default using SearchView.SetIconifiedByDefault(Boolean). This is the default, so nothing needs to be done.

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

For information about using SearchView, read the Search developer guide.

See Also

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 11

The members of Android.Widget.SearchView are listed below.

See Also: LinearLayout

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

IconifiedBoolean. Returns the current iconified state of the SearchView.
[read-only]
ImeOptionsImeAction. Returns the IME options set on the query text field.
[read-only]
InputTypeInputTypes. Returns the input type set on the query text field.
[read-only]
IsIconfiedByDefaultBoolean. Returns the default iconified state of the search field.
[read-only]
MaxWidthInt32. Gets the specified maximum width in pixels, if set.
[read-only]
QueryString.
[read-only]
QueryFormattedICharSequence. Returns the query string currently in the text field.
[read-only]
QueryHintString.
[read-only]
QueryHintFormattedICharSequence. Returns the hint text that will be displayed in the query text field.
QueryRefinementEnabledBoolean. Returns whether query refinement is enabled for all items or only specific ones.
SubmitButtonEnabledBoolean. Returns whether the submit button is enabled when necessary or never displayed.
SuggestionsAdapterCursorAdapter. Returns the adapter used for suggestions, if any.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

OnActionViewCollapsed()
Called when this view is collapsed as an action view.
OnActionViewExpanded()
Called when this view is expanded as an action view.
SetIconifiedByDefault(Boolean)
Sets the default or resting state of the search field.
SetImeOptions(ImeAction)
Sets the IME options on the query text field.
SetInputType(InputTypes)
Sets the input type on the query text field.
SetMaxWidth(Int32)
Makes the view at most this many pixels wide
SetOnCloseListener(SearchView+IOnCloseListener)
Sets a listener to inform when the user closes the SearchView.
SetOnQueryTextFocusChangeListener(View+IOnFocusChangeListener)
Sets a listener to inform when the focus of the query text field changes.
SetOnQueryTextListener(SearchView+IOnQueryTextListener)
Sets a listener for user actions within the SearchView.
SetOnSearchClickListener(View+IOnClickListener)
Sets a listener to inform when the search button is pressed.
SetOnSuggestionListener(SearchView+IOnSuggestionListener)
Sets a listener to inform when a suggestion is focused or clicked.
SetQuery(ICharSequence, Boolean)
Sets a query string in the text field and optionally submits the query as well.
SetQuery(String, Boolean)
SetQueryHint(ICharSequence)
Sets the hint text to display in the query text field.
SetQueryHint(String)
SetSearchableInfo(SearchableInfo)
Sets the SearchableInfo for this SearchView.

Public Events