AUSearchInputBox (previously known as APSocialTagSearchBar) provides a search title bar containing a search box and a Search button on the right. To use this component, you need to set the height of View.
Dependency
See Quick start.
API description
/**
* Set the maximum input length.
*/
public void setInputMaxLength();
/**
* Get the Delete button.
* @return
*/
public AUIconView getClearButton();
/**
* Get the search input box.
* @return
*/
public AUEditText getSearchEditView();
/**
* Get the voice search button.
* @return
*/
public AUIconView getVoiceButton();
Custom properties
Property | Description | Type |
isShowSearchBtn | Whether to show the Search button. | Boolean |
isShowVoiceSearch | Whether to show the voice search button. | Boolean |
searchEditText | The default text in the search box. | String, Reference |
searchEditHint | The default prompt content in the search box. | String, Reference |
inputMaxLength | The maximum length of the search box. | Integer, Reference |
hintIconUnicode | The Unicode of the icon on the left side of the edit box. | String, Reference |
hintIconDrawable | The resource of the icon on the left side of the edit box. | Reference |
editHintColor | The color of the prompt content 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 sample
XML
<com.alipay.mobile.antui.basic.AUSearchInputBox
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_marginTop="10dp"
app:searchEditHint="Dimmed text prompt" />
AUSearchInputBox inputBox = new AUSearchInputBox(this);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,300);
inputBox.setLayoutParams(layoutParams);
layout.addView(inputBox);