仿ios,网易,京东的搜索界面和功能

由于最新项目需要实现一个搜索功能,需求是和ios的样式相同,ios有第三方库直接引用就可以使用,而android这边全是md风格的,并不是我想要的,所以只能自己写了,如果有时间一定封装成库。首先看下效果图
这里写图片描述

 首先看下需要用到的东西,1,首页搜索是一个TextView自不必说,主要是热门搜索的流式布局,但是今天的主角不是它,如果不太懂的朋友可以移步这里:[Android中常见的流式布局的使用 ](http://blog.csdn.net/sinat_36668731/article/details/53198172),2.就是历史搜索,这里需要用到数据库的一些知识,我会在后面具体说明。首先看下xml代码,非常的简单:
  <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="92px"
            android:gravity="center_vertical"
            android:focusable="true"
            android:padding="6px"
            android:background="@color/colorTextGroupBg"
            android:focusableInTouchMode="true"
            android:orientation="horizontal">
            <EditText
                android:id="@+id/et_search"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center_vertical"
                android:layout_margin="6px"
                android:layout_weight="1"
                android:background="@drawable/edit_text_bg"
                android:focusable="false"
                android:focusableInTouchMode="false"
                android:hint="   请输入要搜索的关键词"
                android:paddingBottom="10px"
                android:paddingLeft="30px"
                android:paddingTop="10px"
                android:textColor="#333"
                android:textColorHint=
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值