移动开发平台 mPaaS 搜索框

By | 2021年4月23日

AUSearchInputBox (原 APSocialTagSearchBar)提供包含搜索框、右侧搜索按钮的搜索标题栏。使用该组件时,需要设置 View 的高度。

效果图

依赖

参见 管理组件依赖

接口说明

  
  1. /**
  2. * 设置最大输入长度
  3. */
  4. public void setInputMaxLength();
  5. /**
  6. * 获取删除按钮
  7. * @return
  8. */
  9. public AUIconView getClearButton();
  10. /**
  11. * 获取搜索输入框
  12. * @return
  13. */
  14. public AUEditText getSearchEditView();
  15. /**
  16. * 获取语音搜索按钮
  17. * @return
  18. */
  19. public AUIconView getVoiceButton();

自定义属性

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

代码示例

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="暗文本提示" />
  
  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);

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

发表回复

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