java.lang.Object | |
↳ | android.support.v4.widget.SearchViewCompat |
Helper for accessing features in
SearchView
introduced after API level 4 in a backwards compatible fashion.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
SearchViewCompat.OnCloseListenerCompat | Callback for closing the query UI. | |||||||||
|
SearchViewCompat.OnQueryTextListenerCompat | Callbacks for changes to the query text. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Returns the query string currently in the text field.
|
||||||||||
|
Returns the current iconified state of the SearchView.
|
||||||||||
|
Returns whether query refinement is enabled for all items or only specific ones.
|
||||||||||
|
Returns whether the submit button is enabled when necessary or never displayed.
|
||||||||||
|
Creates a new SearchView.
|
||||||||||
|
Iconifies or expands the SearchView.
|
||||||||||
|
Sets the IME options on the query text field.
|
||||||||||
|
Sets the input type on the query text field.
|
||||||||||
|
Makes the view at most this many pixels wide
|
||||||||||
|
Sets a listener to inform when the user closes the SearchView.
|
||||||||||
|
Sets a listener for user actions within the SearchView.
|
||||||||||
|
Sets a query string in the text field and optionally submits the query as well.
|
||||||||||
|
Sets the hint text to display in the query text field.
|
||||||||||
|
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.
|
||||||||||
|
Sets the SearchableInfo for this SearchView.
|
||||||||||
|
Enables showing a submit button when the query is non-empty.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Returns the query string currently in the text field.
searchView | The SearchView to operate on. |
---|
Returns the current iconified state of the SearchView.
searchView | The SearchView to operate on. |
---|
Returns whether query refinement is enabled for all items or only specific ones.
searchView | The SearchView to operate on. |
---|
Returns whether the submit button is enabled when necessary or never displayed.
searchView | The SearchView to operate on. |
---|
Creates a new SearchView.
context | The Context the view is running in. |
---|
Iconifies or expands the SearchView. Any query text is cleared when iconified. This is a temporary state and does not override the default iconified state set by setIconifiedByDefault(boolean). If the default state is iconified, then a false here will only be valid until the user closes the field. And if the default state is expanded, then a true here will only clear the text field and not close it.
searchView | The SearchView to operate on. |
---|---|
iconify | a true value will collapse the SearchView to an icon, while a false will expand it. |
Sets the IME options on the query text field. This is a no-op if
called on pre-
ICE_CREAM_SANDWICH
platforms.
searchView | The SearchView to operate on. |
---|---|
imeOptions | the options to set on the query text field |
Sets the input type on the query text field. This is a no-op if
called on pre-
ICE_CREAM_SANDWICH
platforms.
searchView | The SearchView to operate on. |
---|---|
inputType | the input type to set on the query text field |
Makes the view at most this many pixels wide
searchView | The SearchView to operate on. |
---|
Sets a listener to inform when the user closes the SearchView.
searchView | The SearchView in which to register the listener. |
---|---|
listener | the listener to call when the user closes the SearchView. |
Sets a listener for user actions within the SearchView.
searchView | The SearchView in which to register the listener. |
---|---|
listener | the listener object that receives callbacks when the user performs actions in the SearchView such as clicking on buttons or typing a query. |
Sets a query string in the text field and optionally submits the query as well.
searchView | The SearchView to operate on. |
---|---|
query | the query string. This replaces any query text already present in the text field. |
submit | whether to submit the query right now or only update the contents of text field. |
Sets the hint text to display in the query text field. This overrides any hint specified in the SearchableInfo.
searchView | The SearchView to operate on. |
---|---|
hint | the hint text to display |
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. Clicking on the query refinement button will replace the text
in the query text field with the text from the suggestion. This flag only takes effect
if a SearchableInfo has been specified with
setSearchableInfo(View, ComponentName)
and not when using a custom adapter.
searchView | The SearchView to operate on. |
---|---|
enable | true if all items should have a query refinement button, false if only those items that have a query refinement flag set should have the button. |
Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used to display labels, hints, suggestions, create intents for launching search results screens and controlling other affordances such as a voice button.
searchView | The SearchView to operate on. |
---|---|
searchableComponent |
The application component whose
SearchableInfo
should be loaded and applied to
the SearchView.
|
Enables showing a submit button when the query is non-empty. In cases where the SearchView is being used to filter the contents of the current activity and doesn't launch a separate results activity, then the submit button should be disabled.
searchView | The SearchView to operate on. |
---|---|
enabled | true to show a submit button for submitting queries, false if a submit button is not required. |