移动开发平台 mPaaS 搜索栏

By | 2021年4月23日

AUSearchBar(原 APSocailSearchBar)提供包含返回按钮、搜索框和右侧搜索按钮的搜索标题栏。

效果图

依赖

参见 管理组件依赖

接口说明

  
  1. /**
  2. * 设置最大输入长度
  3. */
  4. public void setInputMaxLength(int length);
  5. /**
  6. * 获取返回按钮
  7. * @return
  8. */
  9. public AUIconView getBackButton() ;
  10. /**
  11. * 获取删除按钮
  12. * @return
  13. */
  14. public AUIconView getClearButton();
  15. /**
  16. * 获取搜索输入框
  17. * @return
  18. */
  19. public AUEditText getSearchEditView();
  20. /**
  21. * 获取搜索按钮
  22. * @return
  23. */
  24. public AUIconView getSearchButton() ;
  25. /**
  26. * 获取搜索布局
  27. * @return
  28. */
  29. public AURelativeLayout getSearchRelativeLayout() ;
  30. /**
  31. * 获取语音搜索按钮
  32. * @return
  33. */
  34. public AUIconView getVoiceButton();
  35. /**
  36. * 增加编辑事件监听
  37. */
  38. public void setEditChangedListener(TextWatcher watcher)

自定义属性

属性名 说明 类型
isShowSearchBtn 是否显示搜索按钮 boolean
isShowVoiceSearch 是否显示语音搜索 boolean
searchEditText 搜索框默认文本 string,reference
searchEditHint 搜索框默认提示内容 string,reference
searchButtonText 搜索按钮的文本 string,reference
inputMaxLength 搜索框的最长限制 integer,reference
hintIconUnicode 编辑框左侧图标的 Unicode string,reference
hintIconDrawable 编辑框左侧图标的资源 reference
backIconUnicode 返回按钮的 Unicode string,reference
backIconDrawable 返回按钮的资源 reference
editHintColor 编辑框内提示内容的颜色 color,reference
editTextColor 编辑框内文本的颜色 color,reference
editIconColor 编辑框内图标的颜色 color,reference

代码示例

  
  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. aui:searchEditText="输入文本"
  6. aui:isShowSearchBtn="true"
  7. aui: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. aui:searchEditHint="暗文本提示"
  13. aui:isShowSearchBtn="true"
  14. aui:isShowVoiceSearch="true"/>

请关注公众号获取更多资料

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注