/** * Sets the hint text to display in the query text field. This overrides any hint specified * in the SearchableInfo. * * @param hint the hint text to display * * @attr ref android.R.styleable#SearchView_queryHint */ public void setQueryHint(CharSequence hint) { mQueryHint = hint; updateQueryHint(); }
/** * Sets the default or resting state of the search field. If true, a single search icon is * shown by default and expands to show the text field and other buttons when pressed. Also, * if the default state is iconified, then it collapses to that state when the close button * is pressed. Changes to this property will take effect immediately. * * <p>The default value is true.</p> * * @param iconified whether the search field should be iconified by default * * @attr ref android.R.styleable#SearchView_iconifiedByDefault */ public void setIconifiedByDefault(boolean iconified) { if (mIconifiedByDefault == iconified) return; mIconifiedByDefault = iconified; updateViewsVisibility(iconified); updateQueryHint(); }
/** * 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. * * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific * activity or a global search provider. */ public void setSearchableInfo(SearchableInfo searchable) { mSearchable = searchable; if (mSearchable != null) { updateSearchAutoComplete(); updateQueryHint(); } // Cache the voice search capability mVoiceButtonEnabled = hasVoiceSearch(); if (mVoiceButtonEnabled) { // Disable the microphone on the keyboard, as a mic is displayed near the text box // TODO: use imeOptions to disable voice input when the new API will be available mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE); } updateViewsVisibility(isIconified()); }