Search bar

Updated at:

AUSearchBar, formerly APSocialSearchBar, provides a search title bar that includes a back button, a search box, and a search button on the right.

Preview

API reference

   /**
     * Sets the maximum input length.
     */
    public void setInputMaxLength(int length);

    /**
     * Gets the back button.
     * @return
     */
    public AUIconView getBackButton() ;

    /**
     * Gets the delete button.
     * @return
     */
    public AUIconView getClearButton();

    /**
     * Gets the search input box.
     * @return
     */
    public AUEditText getSearchEditView();

    /**
     * Gets the search button.
     * @return
     */
    public AUIconView getSearchButton() ;

    /**
     * Gets the search layout.
     * @return
     */
    public AURelativeLayout getSearchRelativeLayout() ;

    /**
     * Gets the voice search button.
     * @return
     */
    public AUIconView getVoiceButton();

         /**
     * Adds a listener for edit events.
     */
        public void setEditChangedListener(TextWatcher watcher)

Custom properties

Property

Description

Type

isShowSearchBtn

Specifies whether to show the search button.

boolean

isShowVoiceSearch

Specifies whether to show the voice search button.

boolean

searchEditText

The default text in the search box.

string, reference

searchEditHint

The default hint text in the search box.

string, reference

searchButtonText

The text of the search button.

string, reference

inputMaxLength

The maximum length of the input in the search box.

integer, reference

hintIconUnicode

The Unicode of the icon on the left of the edit box.

string, reference

hintIconDrawable

The resource for the icon on the left of the edit box.

reference

backIconUnicode

The Unicode of the back button.

string, reference

backIconDrawable

The resource for the back button.

reference

editHintColor

The color of the hint text in the edit box.

color, reference

editTextColor

The color of the text in the edit box.

color, reference

editIconColor

The color of the icon in the edit box.

color, reference

Code example

<com.alipay.mobile.antui.basic.AUSearchBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        aui:searchEditText="Input text"
        aui:isShowSearchBtn="true"
        aui:isShowVoiceSearch="true"/>

    <com.alipay.mobile.antui.basic.AUSearchBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        aui:searchEditHint="Hint text"
        aui:isShowSearchBtn="true"
        aui:isShowVoiceSearch="true"/>