|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.ViewGroup
android.widget.LinearLayout
com.actionbarsherlock.widget.SearchView
public class SearchView
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.
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 setIconifiedByDefault(true). 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.
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW| Nested Class Summary | |
|---|---|
static interface |
SearchView.OnCloseListener
|
static interface |
SearchView.OnQueryTextListener
Callbacks for changes to the query text. |
static interface |
SearchView.OnSuggestionListener
Callback interface for selection events on suggestions. |
static class |
SearchView.SearchAutoComplete
Local subclass for AutoCompleteTextView. |
| Nested classes/interfaces inherited from class android.widget.LinearLayout |
|---|
android.widget.LinearLayout.LayoutParams |
| Nested classes/interfaces inherited from class android.view.ViewGroup |
|---|
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener |
| Nested classes/interfaces inherited from class android.view.View |
|---|
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener |
| Field Summary |
|---|
| Fields inherited from class android.widget.LinearLayout |
|---|
HORIZONTAL, SHOW_DIVIDER_BEGINNING, SHOW_DIVIDER_END, SHOW_DIVIDER_MIDDLE, SHOW_DIVIDER_NONE, VERTICAL |
| Fields inherited from class android.view.ViewGroup |
|---|
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE |
| Fields inherited from class android.view.View |
|---|
ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_RESOLVED_DEFAULT, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y |
| Constructor Summary | |
|---|---|
SearchView(android.content.Context context)
|
|
SearchView(android.content.Context context,
android.util.AttributeSet attrs)
|
|
| Method Summary | |
|---|---|
void |
clearFocus()
|
int |
getImeOptions()
Returns the IME options set on the query text field. |
int |
getInputType()
Returns the input type set on the query text field. |
int |
getMaxWidth()
Gets the specified maximum width in pixels, if set. |
CharSequence |
getQuery()
Returns the query string currently in the text field. |
CharSequence |
getQueryHint()
Gets the hint text to display in the query text field. |
android.support.v4.widget.CursorAdapter |
getSuggestionsAdapter()
Returns the adapter used for suggestions, if any. |
boolean |
isIconfiedByDefault()
Returns the default iconified state of the search field. |
boolean |
isIconified()
Returns the current iconified state of the SearchView. |
boolean |
isQueryRefinementEnabled()
Returns whether query refinement is enabled for all items or only specific ones. |
boolean |
isSubmitButtonEnabled()
Returns whether the submit button is enabled when necessary or never displayed. |
void |
onActionViewCollapsed()
Called when this view is collapsed as an action view. |
void |
onActionViewExpanded()
Called when this view is expanded as an action view. |
protected void |
onDetachedFromWindow()
|
void |
onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
|
void |
onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
|
boolean |
onKeyDown(int keyCode,
android.view.KeyEvent event)
Handles the key down event for dealing with action keys. |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
|
void |
onWindowFocusChanged(boolean hasWindowFocus)
|
boolean |
requestFocus(int direction,
android.graphics.Rect previouslyFocusedRect)
|
void |
setAppSearchData(android.os.Bundle appSearchData)
Sets the APP_DATA for legacy SearchDialog use. |
void |
setIconified(boolean iconify)
Iconifies or expands the SearchView. |
void |
setIconifiedByDefault(boolean iconified)
Sets the default or resting state of the search field. |
void |
setImeOptions(int imeOptions)
Sets the IME options on the query text field. |
void |
setInputType(int inputType)
Sets the input type on the query text field. |
void |
setMaxWidth(int maxpixels)
Makes the view at most this many pixels wide |
void |
setOnCloseListener(SearchView.OnCloseListener listener)
Sets a listener to inform when the user closes the SearchView. |
void |
setOnQueryTextFocusChangeListener(android.view.View.OnFocusChangeListener listener)
Sets a listener to inform when the focus of the query text field changes. |
void |
setOnQueryTextListener(SearchView.OnQueryTextListener listener)
Sets a listener for user actions within the SearchView. |
void |
setOnSearchClickListener(android.view.View.OnClickListener listener)
Sets a listener to inform when the search button is pressed. |
void |
setOnSuggestionListener(SearchView.OnSuggestionListener listener)
Sets a listener to inform when a suggestion is focused or clicked. |
void |
setQuery(CharSequence query,
boolean submit)
Sets a query string in the text field and optionally submits the query as well. |
void |
setQueryHint(CharSequence hint)
Sets the hint text to display in the query text field. |
void |
setQueryRefinementEnabled(boolean enable)
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. |
void |
setSearchableInfo(android.app.SearchableInfo searchable)
Sets the SearchableInfo for this SearchView. |
void |
setSubmitButtonEnabled(boolean enabled)
Enables showing a submit button when the query is non-empty. |
void |
setSuggestionsAdapter(android.support.v4.widget.CursorAdapter adapter)
You can set a custom adapter if you wish. |
| Methods inherited from class android.widget.LinearLayout |
|---|
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getBaseline, getBaselineAlignedChildIndex, getDividerDrawable, getDividerPadding, getOrientation, getShowDividers, getWeightSum, isBaselineAligned, isMeasureWithLargestChildEnabled, onDraw, onLayout, setBaselineAligned, setBaselineAlignedChildIndex, setDividerDrawable, setDividerPadding, setGravity, setHorizontalGravity, setMeasureWithLargestChildEnabled, setOrientation, setShowDividers, setVerticalGravity, setWeightSum, shouldDelayChildPressedState |
| Methods inherited from class android.view.ViewGroup |
|---|
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewsWithText, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutTransition, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptHoverEvent, onInterceptTouchEvent, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout |
| Methods inherited from class android.view.View |
|---|
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchPopulateAccessibilityEvent, draw, findViewById, findViewWithTag, focusSearch, forceLayout, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLayerType, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasOnClickListeners, hasOverlappingRendering, hasTransientState, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLayerType, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.view.ViewParent |
|---|
createContextMenu, getParent, getParentForAccessibility, isLayoutRequested, requestFitSystemWindows, requestLayout |
| Constructor Detail |
|---|
public SearchView(android.content.Context context)
public SearchView(android.content.Context context,
android.util.AttributeSet attrs)
| Method Detail |
|---|
public void setSearchableInfo(android.app.SearchableInfo searchable)
searchable - a SearchableInfo can be retrieved from the SearchManager, for a specific
activity or a global search provider.public void setAppSearchData(android.os.Bundle appSearchData)
appSearchData - bundle provided by the app when launching the search dialogpublic void setImeOptions(int imeOptions)
imeOptions - the options to set on the query text fieldTextView.setImeOptions(int)public int getImeOptions()
TextView.setImeOptions(int)public void setInputType(int inputType)
inputType - the input type to set on the query text fieldTextView.setInputType(int)public int getInputType()
public boolean requestFocus(int direction,
android.graphics.Rect previouslyFocusedRect)
requestFocus in class android.view.ViewGrouppublic void clearFocus()
clearFocus in class android.view.ViewGrouppublic void setOnQueryTextListener(SearchView.OnQueryTextListener 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.public void setOnCloseListener(SearchView.OnCloseListener listener)
listener - the listener to call when the user closes the SearchView.public void setOnQueryTextFocusChangeListener(android.view.View.OnFocusChangeListener listener)
listener - the listener to inform of focus changes.public void setOnSuggestionListener(SearchView.OnSuggestionListener listener)
listener - the listener to inform of suggestion selection events.public void setOnSearchClickListener(android.view.View.OnClickListener listener)
setIconified(false) can also cause this listener to be informed.
listener - the listener to inform when the search button is clicked or
the text field is programmatically de-iconified.public CharSequence getQuery()
public void setQuery(CharSequence query,
boolean submit)
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.public void setQueryHint(CharSequence hint)
hint - the hint text to displaypublic CharSequence getQueryHint()
public void setIconifiedByDefault(boolean iconified)
The default value is true.
iconified - whether the search field should be iconified by defaultpublic boolean isIconfiedByDefault()
public void setIconified(boolean iconify)
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.
iconify - a true value will collapse the SearchView to an icon, while a false will
expand it.public boolean isIconified()
public void setSubmitButtonEnabled(boolean enabled)
enabled - true to show a submit button for submitting queries, false if a submit
button is not required.public boolean isSubmitButtonEnabled()
public void setQueryRefinementEnabled(boolean enable)
setSearchableInfo(SearchableInfo)
and not when using a custom adapter.
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.SearchManager.SUGGEST_COLUMN_FLAGS,
SearchManager.FLAG_QUERY_REFINEMENTpublic boolean isQueryRefinementEnabled()
public void setSuggestionsAdapter(android.support.v4.widget.CursorAdapter adapter)
setSearchableInfo(SearchableInfo)public android.support.v4.widget.CursorAdapter getSuggestionsAdapter()
public void setMaxWidth(int maxpixels)
public int getMaxWidth()
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
onMeasure in class android.widget.LinearLayoutprotected void onDetachedFromWindow()
onDetachedFromWindow in class android.view.View
public boolean onKeyDown(int keyCode,
android.view.KeyEvent event)
onKeyDown in interface android.view.KeyEvent.CallbackonKeyDown in class android.view.ViewkeyCode - This is the keycode of the typed key, and is the same value as
found in the KeyEvent parameter.event - The complete event record for the typed key
public void onWindowFocusChanged(boolean hasWindowFocus)
onWindowFocusChanged in class android.view.Viewpublic void onActionViewCollapsed()
MenuItem.collapseActionView().
onActionViewCollapsed in interface CollapsibleActionViewpublic void onActionViewExpanded()
MenuItem.expandActionView().
onActionViewExpanded in interface CollapsibleActionViewpublic void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
onInitializeAccessibilityEvent in class android.widget.LinearLayoutpublic void onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
onInitializeAccessibilityNodeInfo in class android.widget.LinearLayout
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||