最开始做搜索框的时候,还以为android系统中的搜索框是自己搭的一个layout,折腾了半天,自己用ImageView,AutoCompleteTextView,ImageButton做了个形似的界面,效果还不错呢,不信看看下面的图片,哈哈,当时超高兴啊:

xml配置如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffffff"
>
<TableLayout
android:stretchColumns="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<ImageView
android:id="@+id/ltpic"
android:layout_marginTop="15px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="http://qiangwei27.blog.163.com/blog/@drawable/smile"/>
<AutoCompleteTextView
android:id="@+id/ltsearch"
android:singleLine ="true"
android:text="@string/hello"
android:selectAllOnFocus="true"
android:completionThreshold="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:dropDownWidth="fill_parent"
android:dropDownHeight="wrap_content"
/>
<ImageButton
android:id="@+id/imgbtnsearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="http://qiangwei27.blog.163.com/blog/@drawable/smile"/>
</TableRow>
</TableLayout>
</LinearLayout>

可是后来发现,自己做的这个编辑框,虽然可以保存历史关键字,但是做输入关键字联想匹配时会很痛苦,后来又遇到另一个更更痛苦的事:就是全屏手写时,后面的那个搜索按钮无法点击(全屏手写时点击那个按钮,默认是画了一个点上去),痛苦了一阵子以后(痛苦也没办法,项目还得继续啊,不然那个帅帅的项目经理天天来催,我更头疼^_^),觉得android所有手机的搜索框都很一致,应该有自己一个搜索控件,所以开始找这个搜索的控件,总算没有白折腾,原来真有这么个东西,唉,这个悔啊,早知道我费那么大劲自己搭个界面干嘛啊,费力不讨好,还得重新来过。。。。

(待续啊///) 评论这张 转发至微博 转发至微博

更多相关文章

  1. android email 邮件转发 附件不能转发问题的解决
  2. android 布局之ConstraintLayout的使用
  3. 自定义控件SettingItemView
  4. layout 布局
  5. Android(安卓)----可伸缩的控件
  6. Android(安卓)自定义控件之第二讲:TypedArray 详解
  7. android自定义控件基础
  8. Android(安卓)中自定义控件和属性
  9. 卷二 Dalvik与Android源码分析 第二章 进程与线程 2.2 Dalvik线

随机推荐

  1. Android TV 焦点原理源码解析
  2. Android UI草图设计器--Pencil
  3. 深入Android【五】—— 任务和进程
  4. android 6.0(api 23) SDK,不再提供org.apa
  5. Linux 3.3内核发布 融合Android源代码
  6. 转-Android原生(Native)C(JNI/NDK)开发之
  7. 转:Android 逆向apk程序的心得
  8. Android(安卓)学习笔记之数据存储SharePr
  9. Android 使用 Gradle 多渠道打包
  10. 〖Android〗屏幕触屏事件录制与回放