All Products
Search
Document Center

Search bar

Last Updated: May 25, 2021

AUSearchBar (previously known as APSocailSearchBar) provides a search title bar containing a Back button, a search box, and a Search button on the right.

Sample image

Dependency

See Quick start.

API description

 
  1. /**
  2. * Set the maximum input length.
  3. */
  4. public void setInputMaxLength(int length);
  5. /**
  6. * Get the Back button.
  7. * @return
  8. */
  9. public AUIconView getBackButton() ;
  10. /**
  11. * Get the Delete button.
  12. * @return
  13. */
  14. public AUIconView getClearButton();
  15. /**
  16. * Get the search input box.
  17. * @return
  18. */
  19. public AUEditText getSearchEditView();
  20. /**
  21. * Get the Search button.
  22. * @return
  23. */
  24. public AUIconView getSearchButton() ;
  25. /**
  26. * Get the search layout.
  27. * @return
  28. */
  29. public AURelativeLayout getSearchRelativeLayout() ;
  30. /**
  31. * Get the voice search button.
  32. * @return
  33. */
  34. public AUIconView getVoiceButton();
  35. /**
  36. * Add editing event listening.
  37. */
  38. public void setEditChangedListener(TextWatcher watcher)

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
searchButtonText The text of the Search button. 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
backIconUnicode The Unicode of the Back button. String, Reference
backIconDrawable The resource of the Back button. 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

 
  1. <com.alipay.mobile.antui.basic.AUSearchBar
  2. android:layout_width="match_parent"
  3. android:layout_height="wrap_content"
  4. android:layout_marginTop="10dp"
  5. app:searchEditText="输入文本"
  6. app:isShowSearchBtn="true"
  7. app:isShowVoiceSearch="true"/>
  8. <com.alipay.mobile.antui.basic.AUSearchBar
  9. android:layout_width="match_parent"
  10. android:layout_height="wrap_content"
  11. android:layout_marginTop="10dp"
  12. app:searchEditHint="暗文本提示"
  13. app:isShowSearchBtn="true"
  14. app:isShowVoiceSearch="true"/>