Android7.0中文API -- SearchView
来源:互联网 发布:mac电脑性能在线测试 编辑:程序博客网 时间:2024/06/05 10:00
完成内容,请查看http://www.zhdoc.net/android/reference/android/widget/SearchView.html
SearchView
public class SearchView
extendsLinearLayout
implements CollapsibleActionView
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.
一个widget,其提供了一个用户界面,用户可以输入一个搜索词条,并向一个search provider提交一个请求。显示查询建议词条的列表或结果,如果可用,则允许用户从中选取一个建议词条或结果,并使用。
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 usingsetIconifiedByDefault(true)
. This is the default, so nothing needs to be done.
当在ActionBar中使用SearchView作为可折叠菜单项的操作视图时,需要将其设置为默认使用setIconifiedByDefault(true)
来将其设置为图标化。这是默认的,因此没有什么需要做。
If you want the search field to always be visible, then call setIconifiedByDefault(false).
如果你需要始终显示搜索字段,则调用setIconifiedByDefault(false)。
开发者指南
For information about using SearchView
, read the Search developer guide.
关于使用SearchView
的更多信息,请阅读Search开发者指南。
See also:
另请参考:
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
摘要
嵌套类
interface
SearchView.OnCloseListener
interface
SearchView.OnQueryTextListener
Callbacks for changes to the query text.
修改查询文本的回调。
interface
SearchView.OnSuggestionListener
Callback interface for selection events on suggestions.
在建议词条上选择事件的回调接口。
XML属性
android:iconifiedByDefault
SearchView的默认状态。 android:imeOptions
IME选项,用于设置在查询文本字段上。 android:inputType
输入类型,用于设置在查询文本字段上。 android:maxWidth
SearchView的最大宽度(可选)。 android:queryHint
在空查询字段中显示的,可选查询提示字符串。 继承XML属性
android.widget.LinearLayout
android.view.ViewGroup
android.view.View
继承常量
android.widget.LinearLayout
android.view.ViewGroup
android.view.View
继承字段
android.view.View
Public构造方法
SearchView(Context context)
SearchView(Context context, AttributeSet attrs)
SearchView(Context context, AttributeSet attrs, int defStyleAttr)
SearchView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public方法
CharSequence
getAccessibilityClassName()
Return the class name of this object to be used for accessibility purposes.
返回此对象的类名,用于辅助功能目的。
int
getImeOptions()
Returns the IME options set on the query text field.
返回IME选项,其用于设置在查询文本字段上。
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()
Returns the hint text that will be displayed in the query text field.
返回提示文本,其显示在查询文本字段中。
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.
返回当前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.
当此视图作为一个操作视图展开时调用。
boolean
onKeyDown(int keyCode,KeyEvent event)
Handles the key down event for dealing with action keys.
处理操作键的按钮按下事件。
void
onWindowFocusChanged(boolean hasWindowFocus)
Called when the window containing this view gains or loses focus.
当包含此视图的窗口获得或失去焦点时,调用此方法。
void
setIconified(boolean iconify)
Iconifies or expands the SearchView.
图标化或展开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.
设置IME选项,其用于查询文本字段上。
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.
设置一个监听器,当用户关闭SearchView时被通知。
void
setOnQueryTextFocusChangeListener(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.
设置一个监听器,当用户在SearchView内操作时被通知。
void
setOnSearchClickListener(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.
指定查询优化按钮是否应该与每个建议词条一起显示,或者是否应该依赖于从建议provider中取回到的个别项中设置的标志。
void
setSearchableInfo(SearchableInfo searchable)
Sets the SearchableInfo for this SearchView.
设置此SearchView的SearchableInfo。
void
setSubmitButtonEnabled(boolean enabled)
Enables showing a submit button when the query is non-empty.
当有查询词条的时候,是否显示一个提交按钮。
void
setSuggestionsAdapter(CursorAdapter adapter)
You can set a custom adapter if you wish.
如果需要,你可以设置一个自定义的适配器。
保护方法
完成内容,请查看http://www.zhdoc.net/android/reference/android/widget/SearchView.html
- Android7.0中文API -- SearchView
- Android7.0中文API---ImageButton
- Android7.0 中文API -- ZoomButton
- Android7.0中文API --- ImageView
- Android7.0中文API -- ListView
- android7.0中文API -- LinearLayout
- Android7.0中文API -- TableLayout
- Android7.0中文API -- TableRow
- Android7.0中文API -- ZoomControls
- Android7.0中文API -- TabWidget
- Android7.0中文API -- ActionMenuView
- Android7.0中文API -- RadioGroup
- Android7.0中文API -- SeekBar
- Android7.0中文API -- ProgressBar
- Android7.0中文API --- AbsSeekBar
- Android7.0中文API -- RatingBar
- Android7.0中文API -- Spinner
- Android7.0中文API -- AbsSpinner
- hdu5781 沈阳day6训练赛
- js判断是不是空对象
- 文章标题
- Tinify API批处理压缩PNG和JPG(Java版本)
- 树(数据结构)
- Android7.0中文API -- SearchView
- 整合Struts2与Spring以及spring的自动装配
- 关于eclipse导出Java项目形成的jar包中没有图片以及图片显示问题
- 三次握手
- Spring源码解析--Spring配置文件解析NamespaceHandler(五)
- jdbc链接数据库
- 计算机图形学——扫描椭圆
- python机器学习包 Windows下 pip安装 scikit-learn numpy scipy
- 《Spark高级数据分析》ChapterII 读书笔记