新聞中心
SearchBar

太和ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書(shū)銷(xiāo)售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話(huà)聯(lián)系或者加微信:18980820575(備注:SSL證書(shū)合作)期待與您的合作!
java.lang.Object
|---ohos.agp.components.Component
|---|---ohos.agp.components.ComponentContainer
|---|---|---ohos.agp.components.DirectionalLayout
|---|---|---|---ohos.agp.components.SearchBar
public class SearchBar
extends DirectionalLayout提供用戶(hù)界面,供用戶(hù)通過(guò)輸入字符串開(kāi)始搜索并獲取搜索結(jié)果。
搜索結(jié)果顯示在列表中。 如果未找到匹配項(xiàng),則結(jié)果為空。 默認(rèn)情況下,搜索組件是一個(gè)圖標(biāo)。
Since:
3
嵌套類(lèi)摘要
| 修飾符和類(lèi)型 | 類(lèi) | 描述 |
|---|---|---|
| static interface | SearchBar.FoldListener | 提供當(dāng)用戶(hù)關(guān)閉搜索欄時(shí)要調(diào)用的回調(diào)。 |
| static interface | SearchBar.QueryListener | 提供當(dāng)用戶(hù)更改查詢(xún)文本或用戶(hù)提交查詢(xún)時(shí)要調(diào)用的回調(diào)。 |
| 從類(lèi) ohos.agp.components.Component 繼承的嵌套類(lèi)/接口 |
|---|
| Component.BindStateChangedListener, Component.CanAcceptScrollListener, Component.ClickedListener, Component.ComponentStateChangedListener, Component.ContourRefreshedListener, Component.DefSpeechEventListener, Component.DoubleClickedListener, Component.DragFeedbackProvider, Component.DraggedListener, Component.DrawTask, Component.EditEventListener, Component.EstimateSizeListener, Component.EstimateSpec, Component.FadeEffectEnum, Component.FocusChangedListener, Component.ForwardHoverListener, Component.ForwardTouchListener, Component.GestureType, Component.HoverEventListener, Component.KeyEventListener, Component.LayoutDirection, Component.LayoutRefreshedListener, Component.LongClickedListener, Component.MeasureSpec, Component.MouseEventListener, Component.MousePointerStyleListener, Component.OnDragListener, Component.RotationEventListener, Component.ScaledListener, Component.ScrolledListener, Component.ShadowDevice, Component.ShadowMode, Component.ShadowSize, Component.SpeechEventListener, Component.TouchEventListener, Component.UnconsumedKeyEventListener, Component.VoiceEvent |
| 從類(lèi) ohos.agp.components.ComponentContainer 繼承的嵌套類(lèi)/接口 |
|---|
| ComponentContainer.ArrangeListener |
| 從類(lèi) ohos.agp.components.DirectionalLayout 繼承的嵌套類(lèi)/接口 |
|---|
| DirectionalLayout.LayoutConfig |
字段摘要
| 從類(lèi) ohos.agp.components.Component 繼承的字段 |
|---|
| ACCESSIBILITY_ADAPTABLE, ACCESSIBILITY_DISABLE, ACCESSIBILITY_ENABLE, AXIS_X, AXIS_Y, CONTOUR_BACKGROUND, CONTOUR_BORDER, CONTOUR_PADDING_BORDER, DEFAULT_SCALE, DRAG_DOWN, DRAG_HORIZONTAL, DRAG_HORIZONTAL_VERTICAL, DRAG_LEFT, DRAG_RIGHT, DRAG_UP, DRAG_VERTICAL, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED_CLEAR, EVENT_TYPE_COMPONENT_CLICKED, EVENT_TYPE_COMPONENT_FOCUSED, EVENT_TYPE_COMPONENT_LONG_CLICKED, EVENT_TYPE_COMPONENT_SCROLLED, EVENT_TYPE_COMPONENT_SELECTED, EVENT_TYPE_COMPONENT_TEXT_UPDATE, EVENT_TYPE_NOTICE, EVENT_TYPE_NOTIFICATION_STATE_UPDATE, EVENT_TYPE_TOAST_SHOW, EVENT_TYPE_WINDOW_STATE_UPDATE, FOCUS_ADAPTABLE, FOCUS_DISABLE, FOCUS_ENABLE, FOCUS_NEXT, FOCUS_PREVIOUS, FOCUS_SIDE_BOTTOM, FOCUS_SIDE_LEFT, FOCUS_SIDE_RIGHT, FOCUS_SIDE_TOP, HIDE, HORIZONTAL, ID_DEFAULT, INHERITED_MODE, INVISIBLE, mBackgroundElement, mCanvasForTaskOverContent, mCanvasForTaskUnderContent, mComponentParent, mContext, mDrawTaskOverContent, mDrawTaskUnderContent, mEstimateSizeListener, mForegroundElement, mForwardHoverListener, mHoverEventListener, mKeyEventListener, mMouseEventListener, mPosition, mRotationEventListener, mShadowElement, mUnconsumedKeyEventListener, OVAL_MODE, OVAL_SCROLL_BAR_MODE, POSITION_X_INDEX, POSITION_Y_INDEX, RECT_MODE, RECT_SCROLL_BAR_MODE, SCROLL_AUTO_STAGE, SCROLL_IDLE_STAGE, SCROLL_NORMAL_STAGE, UNSPECIFIED_SCROLL_BAR_MODE, VERTICAL, VISIBLE |
| 從類(lèi) ohos.agp.components.ComponentContainer 繼承的字段 |
|---|
| FOCUS_CHILDREN_FIRST, FOCUS_CHILDREN_HIDE, FOCUS_PARENT_FIRST, mArrangeListener |
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| SearchBar(Context context) | 用于使用默認(rèn)屬性集和樣式創(chuàng)建 SearchBar 實(shí)例的默認(rèn)構(gòu)造函數(shù)。 |
| SearchBar(Context context, AttrSet attrSet) | 用于在解析 XML 文件后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 SearchBar 實(shí)例的構(gòu)造函數(shù)。 |
| SearchBar(Context context, AttrSet attrSet, String styleName) | 用于在解析 XML 文件后使用指定的屬性集和指定的樣式創(chuàng)建 SearchBar 實(shí)例的構(gòu)造函數(shù)。 |
方法總結(jié)
| 修飾符和類(lèi)型 | 方法 | 描述 |
|---|---|---|
| void | activateSubmitButton(boolean enabled) | 指定如果查詢(xún)不為空,提交按鈕是否必須可用。 |
| void | addComponent(Component childComponent) | 通過(guò)在內(nèi)部調(diào)用 ComponentContainer.addComponent(ohos.agp.components.Component,int index) 將組件添加到隊(duì)列的末尾。 |
| Image | getCloseButton() | 獲取此 SearchBar 的關(guān)閉按鈕。 |
| SearchBar.FoldListener | getFoldListener() | 獲取監(jiān)聽(tīng)此 SearchBar 關(guān)閉的監(jiān)聽(tīng)器。 |
| boolean | getIconifiedState() | 獲取搜索欄的當(dāng)前狀態(tài)。 |
| int | getMaxWidth() | 獲取為搜索欄指定的最大寬度。 |
| String | getQuery() | 獲取搜索欄中的搜索字符串。 |
| String | getQueryHint() | 獲取搜索欄中的提示文本。 |
| SearchBar.QueryListener | getQueryListener() | 獲取監(jiān)聽(tīng)此SearchBar中搜索字符串的更改或提交的監(jiān)聽(tīng)器。 |
| Image | getSearchButton() | 獲取此 SearchBar 的搜索按鈕。 |
| Component.ClickedListener | getSearchClickListener() | 獲取單擊搜索按鈕時(shí)發(fā)送的通知的偵聽(tīng)器。 |
| Image | getSearchIcon() | 獲取此 SearchBar 的搜索圖標(biāo)。 |
| TextField | getSearchText() | 獲取此 SearchBar 的搜索文本。 |
| Color | getSearchTextColor() | 獲取搜索框的文字顏色。 |
| Image | getSubmitButton() | 獲取此 SearchBar 的提交按鈕。 |
| int | getTextSize() | 獲取搜索欄的文本大小。 |
| boolean | isSearchButtonEnable() | 必要時(shí)檢查是否啟用了提交按鈕。 |
| void | setCloseButton(int resId) | 設(shè)置關(guān)閉按鈕的圖像資源 ID。 |
| void | setCloseButton(PixelMap pixelMap) | 設(shè)置關(guān)閉按鈕的圖像 URI。 |
| void | setFoldListener(SearchBar.FoldListener listener) | 設(shè)置一個(gè)偵聽(tīng)器以通知用戶(hù)何時(shí)關(guān)閉 SearchBar。 |
| void | setIconifiedState(boolean state) | 設(shè)置是圖標(biāo)化還是展開(kāi)搜索欄。 |
| void | setMaxWidth(int maxPixels) | 設(shè)置搜索欄的最大寬度,以像素為單位。 |
| void | setQuery(String query, boolean submit) | 設(shè)置搜索字符串和搜索模式。 |
| void | setQueryFocusChangeListener(Component.FocusChangedListener listener) | 設(shè)置偵聽(tīng)器以通知查詢(xún)文本字段的焦點(diǎn)何時(shí)更改。 |
| void | setQueryListener(SearchBar.QueryListener listener) | 設(shè)置偵聽(tīng)器以通知用戶(hù)何時(shí)更改或提交搜索欄中的搜索字符串。 |
| void | setSearchButton(int resId) | 設(shè)置搜索按鈕的圖像資源 ID。 |
| void | setSearchButton(PixelMap pixelMap) | 設(shè)置搜索按鈕的 pixelMap。 |
| void | setSearchClickListener(Component.ClickedListener listener) | 設(shè)置偵聽(tīng)器以在按下搜索按鈕時(shí)進(jìn)行通知。 |
| void | setSearchHint(String searchHint) | 設(shè)置在搜索框中顯示的提示文本。 |
| void | setSearchIcon(int resId) | 設(shè)置搜索圖標(biāo)的圖像資源 ID。 |
| void | setSearchIcon(PixelMap pixelMap) | 設(shè)置搜索圖標(biāo)的 pixelMap。 |
| void | setSearchTextColor(Color color) | 設(shè)置搜索框的文本顏色。 |
| void | setSubmitButton(int resId) | 設(shè)置提交按鈕的圖像資源 ID。 |
| void | setSubmitButton(PixelMap pixelMap) | 設(shè)置提交按鈕的pixelMap。 |
| void | setTextSize(int textSize) | 設(shè)置搜索欄的文本大小。 |
| 從類(lèi) ohos.agp.components.Component 繼承的方法 |
|---|
| addDrawTask, addDrawTask, addScrolledListener, announceAccessibility, arrange, bindCornerMark, callOnClick, canScroll, clearFocus, createAnimatorProperty, disableFadeEffect, draw, enableCornerMark, enableFadeEffect, enableSaveState, enableScrollBar, estimateSize, executeDoubleClick, executeLongClick, findFocus, findNextFocusableComponent, findRequestNextFocus, getAccessibility, getAccessibilityDescription, getAlpha, getAltitude, getBackgroundElement, getBaseLine, getBottom, getBoundaryFadeEffectBottomRate, getBoundaryFadeEffectLeftRate, getBoundaryFadeEffectRightRate, getBoundaryFadeEffectTopRate, getCenterZoomFactor, getCentralScrollMode, getClickedListener, getClipEnabled, getComponentDescription, getComponentMinSize, getComponentParent, getComponentPosition, getComponentSize, getComponentStateChangedListener, getComponentTreeObserver, getContentEnable, getContentPosition, getContentPositionX, getContentPositionY, getContext, getContour, getContourRefreshedListener, getCornerMark, getDragAcceptAngle, getDraggedListener, getEditEventListener, getEstimatedHeight, getEstimatedWidth, getFadeEffectBoundaryWidth, getFadeEffectColor, getFocusable, getFocusBorderEnable, getFocusBorderPadding, getFocusBorderRadius, getFocusBorderWidth, getForegroundElement, getForegroundGravity, getForwardHoverListener, getForwardTouchListener, getGesturePriority, getHeight, getHorizontalPadding, getHorizontalPosition, getHoverEventListener, getId, getKeyEventListener, getLayoutConfig, getLayoutDirection, getLayoutDirectionResolved, getLayoutRefreshedListener, getLeft, getLocationOnScreen, getMarginBottom, getMarginLeft, getMarginRight, getMargins, getMarginsLeftAndRight, getMarginsTopAndBottom, getMarginTop, getMatrix, getMinHeight, getMinWidth, getMode, getModeResolved, getMouseEventListener, getMousePointerStyleListener, getName, getPadding, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getPivot, getPivotX, getPivotY, getResourceManager, getRight, getRotation, getRotationEventListener, getRotationSensitivity, getScale, getScaledListener, getScaleX, getScaleY, getScrollbarBackgroundColor, getScrollbarColor, getScrollbarFadingDelay, getScrollbarFadingDuration, getScrollBarMode, getScrollbarRadius, getScrollbarRoundRect, getScrollbarStartAngle, getScrollbarSweepAngle, getScrollbarThickness, getScrollState, getScrollValue, getSelfVisibleRect, getShadowColor, getSpeechEventListener, getTag, getTop, getTouchEventListener, getTransitionSymbol, getTranslation, getTranslationX, getTranslationY, getTranslationZ, getUserNextFocus, getVerticalPadding, getVerticalPosition, getVisibility, getVisibleRectOnScreen, getWidth, getWindowVisibleRect, hasFocus, hasFocusedEffect, hasOverlaps, hideFocusBorder, invalidate, isBoundaryFadeEffectEnable, isBoundToWindow, isClickable, isClipToContourEnabled, isComponentDisplayed, isEnabled, isFadeEffected, isFocusable, isFocused, isIdentityMatrix, isLongClickOn, isPressed, isRtl, isSaveStateEnabled, isScrollbarFadingOn, isScrollBarOn, isScrollbarOverlapEnabled, isSelected, isSoundEnable, isTouchFocusable, isVibrationEffectEnabled, notifyAccessibility, onAttributeConfigChanged, onRestoreState, onRtlChanged, onSaveState, performScale, playSound, postLayout, refreshContour, release, removeBindStateChangedListener, removeScrolledListener, requestFocus, requestForceForwardTouchEvent, restoreComponentTreeState, saveComponentTreeState, scrollBy, scrollTo, setAccessibility, setAccessibilityDescription, setAlpha, setAltitude, setBackground, setBindStateChangedListener, setBottom, setBoundaryFadeEffectEnable, setCanAcceptScrollListener, setCenterZoomFactor, setCentralScrollMode, setClickable, setClickedListener, setClipEnabled, setClipToContourEnabled, setComponentDescription, setComponentMinSize, setComponentPosition, setComponentPosition, setComponentSize, setComponentStateChangedListener, setContentEnable, setContentPosition, setContentPositionX, setContentPositionY, setContour, setContourRefreshedListener, setDoubleClickedListener, setDragAcceptAngle, setDraggedListener, setEditEventListener, setEnabled, setEstimatedSize, setEstimateSizeListener, setFadeEffectBoundaryWidth, setFadeEffectColor, setFocusable, setFocusBorderEnable, setFocusBorderPadding, setFocusBorderRadius, setFocusBorderRadius, setFocusBorderWidth, setFocusChangedListener, setFocusedEffect, setForeground, setForegroundGravity, setForwardHoverListener, setForwardTouchListener, setGesturePriority, setHeight, setHorizontalPadding, setHorizontalPosition, setHoverEventListener, setId, setKeyEventListener, setLayoutConfig, setLayoutDirection, setLayoutRefreshedListener, setLeft, setLongClickable, setLongClickedListener, setMarginBottom, setMarginLeft, setMarginRight, setMarginsLeftAndRight, setMarginsTopAndBottom, setMarginTop, setMinHeight, setMinWidth, setMode, setMouseEventListener, setMousePointerStyleListener, setName, setOnDragListener, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRelative, setPaddingRight, setPaddingTop, setPivot, setPivot, setPivotX, setPivotY, setPosition, setPositionX, setPositionY, setPressState, setRight, setRotation, setRotationEventListener, setRotationSensitivity, setScale, setScaledListener, setScaleX, setScaleY, setScrollbarBackgroundColor, setScrollbarColor, setScrollbarFadingDelay, setScrollbarFadingDuration, setScrollbarFadingEnabled, setScrollBarMode, setScrollbarOverlapEnabled, setScrollbarRadius, setScrollbarRoundRect, setScrollbarStartAngle, setScrollbarSweepAngle, setScrollbarThickness, setScrolledListener, setSelected, setShadowColor, setShadowStyle, setSoundEnable, setSpeechEventListener, setTag, setTop, setTouchEventListener, setTouchFocusable, setTransitionSymbol, setTranslation, setTranslationX, setTranslationY, setTranslationZ, setUnconsumedKeyEventListener, setUserNextFocus, setVerticalPadding, setVerticalPosition, setVibrationEffectEnabled, setVisibility, setWidth, showFocusBorder, simulateClick, simulateDrag, startDragAndDrop, subscribeVoiceEvents, unsubscribeVoiceEvents |
| 從類(lèi) ohos.agp.components.ComponentContainer 繼承的方法 |
|---|
| addComponent, addComponent, addComponent, addComponent, dispatchRestoreState, dispatchSaveState, findComponentById, findComponentHolderById, getAutoLayout, getChildCount, getChildIndex, getComponentAt, getComponentTransition, getFocusOrder, getLayoutManager, informConfigurationChanged, isClipToChildBoundsEnabled, isClipToPaddingBoundsEnabled, isTouchEventSplitable, moveChildToFront, onDrag, removeAllComponents, removeComponent, removeComponentAt, removeComponentById, removeComponents, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setLayoutManager, setTouchEventSplitable |
| 從接口 ohos.agp.components.ComponentParent 繼承的方法 |
|---|
| getComponentParent, postLayout |
| 從類(lèi) ohos.agp.components.DirectionalLayout 繼承的方法 |
|---|
| createLayoutConfig, getAlignment, getOrientation, getTotalWeight, isLayoutBaselined, setAlignment, setLayoutBaselined, setOrientation, setTotalWeight, verifyLayoutConfig |
| 從類(lèi) java.lang.Object 繼承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
構(gòu)造函數(shù)詳細(xì)信息
SearchBar
public SearchBar(Context context)
用于使用默認(rèn)屬性集和樣式創(chuàng)建 SearchBar 實(shí)例的默認(rèn)構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
SearchBar
public SearchBar(Context context, AttrSet attrSet)
用于在解析 XML 文件后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 SearchBar 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
SearchBar
public SearchBar(Context context, AttrSet attrSet, String styleName)
用于在解析 XML 文件后使用指定的屬性集和指定的樣式創(chuàng)建 SearchBar 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
| styleName | 指示要使用的樣式名稱(chēng)。 |
方法詳情
addComponent
public void addComponent(Component childComponent)
通過(guò)在內(nèi)部調(diào)用 ComponentContainer.addComponent(ohos.agp.components.Component,int index) 將組件添加到隊(duì)列的末尾。
覆蓋:
類(lèi) ComponentContainer 中的 addComponent
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| childComponent | 指示要添加的子組件。 |
getSearchText
public TextField getSearchText()
獲取此 SearchBar 的搜索文本。
返回:
返回搜索文本。
Since:
4
getSearchButton
public Image getSearchButton()
獲取此 SearchBar 的搜索按鈕。
返回:
返回搜索按鈕。
Since:
4
getSearchIcon
public Image getSearchIcon()
獲取此 SearchBar 的搜索圖標(biāo)。
返回:
返回搜索圖標(biāo)。
Since:
4
getSubmitButton
public Image getSubmitButton()
獲取此 SearchBar 的提交按鈕。
返回:
返回提交按鈕。
Since:
4
getCloseButton
public Image getCloseButton()
獲取此 SearchBar 的關(guān)閉按鈕。
返回:
返回關(guān)閉按鈕。
Since:
4
setTextSize
public void setTextSize(int textSize)
設(shè)置搜索欄的文本大小。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| textSize | 指示搜索欄中的文本大小。 |
Since:
3
getTextSize
public int getTextSize()
獲取搜索欄的文本大小。
返回:
返回搜索欄的文本大小。
Since:
3
setQuery
public void setQuery(String query, boolean submit)
設(shè)置搜索字符串和搜索模式。 提供兩種搜索模式:立即開(kāi)始搜索; 或僅更新搜索字符串,然后單擊搜索按鈕開(kāi)始搜索。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| query | 表示搜索字符串。 |
| submit | true 表示在搜索字符串更新后立即開(kāi)始搜索; false 表示只更新搜索字符串,而不是立即開(kāi)始搜索。 |
Since:
3
getQuery
public String getQuery()
獲取搜索欄中的搜索字符串。
返回:
返回搜索欄中的搜索字符串。
Since:
3
setSearchHint
public void setSearchHint(String searchHint)
設(shè)置在搜索框中顯示的提示文本。
在初始化時(shí)或在用戶(hù)提供任何搜索字符串之前,提示文本會(huì)顯示在搜索框中。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| searchHint | 指示要在搜索框中顯示的提示文本。 |
Since:
4
getQueryHint
public String getQueryHint()
獲取搜索欄中的提示文本。
返回:
返回搜索欄中顯示的提示文本。
Since:
3
setMaxWidth
public void setMaxWidth(int maxPixels)
設(shè)置搜索欄的最大寬度,以像素為單位。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| maxPixels | 指示搜索欄的最大寬度,以像素為單位。 |
Since:
3
getMaxWidth
public int getMaxWidth()
獲取為搜索欄指定的最大寬度。
返回:
返回搜索欄的最大寬度; 如果未指定最大寬度,則返回 0。
Since:
3
setIconifiedState
public void setIconifiedState(boolean state)
設(shè)置是圖標(biāo)化還是展開(kāi)搜索欄。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| state | 指示是圖標(biāo)化還是展開(kāi)搜索欄。 true 意味著圖標(biāo)化搜索欄, false 意味著擴(kuò)展它。 |
Since:
4
getIconifiedState
public boolean getIconifiedState()
獲取搜索欄的當(dāng)前狀態(tài)。
返回:
如果搜索欄被圖標(biāo)化,則返回 true; 如果展開(kāi)則返回 false。
Since:
4
setFoldListener
public void setFoldListener(SearchBar.FoldListener listener)
設(shè)置一個(gè)偵聽(tīng)器以通知用戶(hù)何時(shí)關(guān)閉 SearchBar。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| listener | 指示當(dāng)用戶(hù)關(guān)閉 SearchBar 時(shí)要調(diào)用的偵聽(tīng)器。 |
Since:
3
getFoldListener
public SearchBar.FoldListener getFoldListener()
獲取監(jiān)聽(tīng)此 SearchBar 關(guān)閉的監(jiān)聽(tīng)器。
返回:
返回監(jiān)聽(tīng)器。
Since:
4
setQueryListener
public void setQueryListener(SearchBar.QueryListener listener)
設(shè)置偵聽(tīng)器以通知用戶(hù)何時(shí)更改或提交搜索欄中的搜索字符串。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| listener | 指示當(dāng)用戶(hù)更改搜索字符串或按下搜索欄中的搜索按鈕時(shí)接收回調(diào)的偵聽(tīng)器對(duì)象。 |
Since:
3
getQueryListener
public SearchBar.QueryListener getQueryListener()
獲取監(jiān)聽(tīng)此SearchBar中搜索字符串的更改或提交的監(jiān)聽(tīng)器。
返回:
返回監(jiān)聽(tīng)器。
Since:
4
setQueryFocusChangeListener
public void setQueryFocusChangeListener(Component.FocusChangedListener listener)
設(shè)置偵聽(tīng)器以通知查詢(xún)文本字段的焦點(diǎn)何時(shí)更改。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| listener | 指示偵聽(tīng)器通知搜索欄中的焦點(diǎn)更改。 |
Since:
3
setSearchClickListener
public void setSearchClickListener(Component.ClickedListener listener)
設(shè)置偵聽(tīng)器以在按下搜索按鈕時(shí)進(jìn)行通知。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| listener | 指示偵聽(tīng)器在按下搜索按鈕或以編程方式對(duì)搜索欄進(jìn)行去圖標(biāo)化時(shí)通知。 |
Since:
3
getSearchClickListener
public Component.ClickedListener getSearchClickListener()
獲取單擊搜索按鈕時(shí)發(fā)送的通知的偵聽(tīng)器。
返回:
返回獲取的監(jiān)聽(tīng)器。
Since:
4
activateSubmitButton
public void activateSubmitButton(boolean enabled)
指定如果查詢(xún)不為空,提交按鈕是否必須可用。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| enabled | 指示提交按鈕的狀態(tài)。 true 表示顯示提交按鈕; false 意味著隱藏它。 |
Since:
4
isSearchButtonEnable
public boolean isSearchButtonEnable()
必要時(shí)檢查是否啟用了提交按鈕。
返回:
如果必要時(shí)自動(dòng)啟用提交按鈕,則返回 true; 否則返回 false。
Since:
4
setSearchButton
public void setSearchButton(PixelMap pixelMap)
設(shè)置搜索按鈕的 pixelMap。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| pixelMap | 表示 PixelMap。 |
Since:
4
setSearchIcon
public void setSearchIcon(PixelMap pixelMap)
設(shè)置搜索圖標(biāo)的 pixelMap。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| pixelMap | 表示 PixelMap。 |
Since:
4
setCloseButton
public void setCloseButton(PixelMap pixelMap)
設(shè)置關(guān)閉按鈕的圖像 URI。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| pixelMap | 表示 PixelMap。 |
Since:
4
setSubmitButton
public void setSubmitButton(PixelMap pixelMap)
設(shè)置提交按鈕的pixelMap。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| pixelMap | 表示 PixelMap。 |
Since:
4
setSearchButton
public void setSearchButton(int resId)
設(shè)置搜索按鈕的圖像資源 ID。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| resId | 表示要設(shè)置的圖片資源ID。 |
Since:
4
setSearchIcon
public void setSearchIcon(int resId)
設(shè)置搜索圖標(biāo)的圖像資源 ID。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| resId | 表示要設(shè)置的圖片資源ID。 |
Since:
4
setSubmitButton
public void setSubmitButton(int resId)
設(shè)置提交按鈕的圖像資源 ID。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| resId | 表示要設(shè)置的圖片資源ID。 |
Since:
4
setCloseButton
public void setCloseButton(int resId)
設(shè)置關(guān)閉按鈕的圖像資源 ID。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| resId | 表示要設(shè)置的圖片資源ID。 |
Since:
4
setSearchTextColor
public void setSearchTextColor(Color color)
設(shè)置搜索框的文本顏色。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| color | 指示文本顏色。 |
getSearchTextColor
public Color getSearchTextColor()
獲取搜索框的文字顏色。
返回:
返回文本顏色。
Since:
4
新聞標(biāo)題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSSearchBar
轉(zhuǎn)載源于:http://fisionsoft.com.cn/article/djohspd.html


咨詢(xún)
建站咨詢(xún)
