All Products
Search
Document Center

Search input box

Last Updated: May 25, 2021

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.

Sample images

Dependency

See Quick start.

API description

 
  1. /**
  2. * Set the maximum input length.
  3. */
  4. public void setInputMaxLength();
  5. /**
  6. * Get the Delete button.
  7. * @return
  8. */
  9. public AUIconView getClearButton();
  10. /**
  11. * Get the search input box.
  12. * @return
  13. */
  14. public AUEditText getSearchEditView();
  15. /**
  16. * Get the voice search button.
  17. * @return
  18. */
  19. 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

Sample code

XML

 
  1. <com.alipay.mobile.antui.basic.AUSearchInputBox
  2. android:layout_width="match_parent"
  3. android:layout_height="52dp"
  4. android:layout_marginTop="10dp"
  5. app:searchEditHint="Dimmed text prompt" />
 
  1. AUSearchInputBox inputBox = new AUSearchInputBox(this);
  2. ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,300);
  3. inputBox.setLayoutParams(layoutParams);
  4. layout.addView(inputBox);