实现搜索页面到商品列表

//activity_main

xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.bwie.test.moni.MainActivity">

    <LinearLayout
        android:background="#eceaea"
        android:gravity="center"
        android:layout_marginTop="20dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:background="@drawable/zuo"
            android:layout_width="30dp"
            android:layout_height="30dp" />
        <EditText
            android:layout_marginLeft="40dp"
            android:layout_marginRight="40dp"
            android:background="@drawable/sou"
            android:id="@+id/et"
            android:layout_width="360dp"
            android:singleLine="true"
            android:hint="落来京东超级商品日"
            android:layout_height="40dp" />
        <Button
            android:id="@+id/sousuo"
            android:background="#eceaea"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="搜索" />
    LinearLayout>

    <TextView
        android:padding="10dp"
        android:textSize="25dp"
        android:text="热搜"
        android:textStyle="bold"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" /> 
    <com.bwie.test.utils.flow
        android:id="@+id/ffff"
android :layout_width= "match_parent" android :layout_height= "100dp"/> < TextView android :padding= "10dp" android :textSize= "25dp" android :text= " 搜索历史 " android :textStyle= "bold" android :id= "@+id/lishi" android :visibility= "invisible" android :layout_width= "wrap_content" android :layout_height= "wrap_content" /> < ListView android :id= "@+id/lv" android :layout_width= "match_parent" android :layout_height= "wrap_content">ListView> < Button android :id= "@+id/qingkong" android :visibility= "invisible" android :layout_width= "match_parent" android :layout_height= "wrap_content" android :text= " 清空历史记录 " />LinearLayout>



//activity_neirong

xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent"
    tools:context="com.bwie.test.moni.NeirongActivity">
    <LinearLayout
        android:orientation="horizontal"
        android:background="#e7e4e4"
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/fan"
            android:layout_marginRight="170dp"
            android:background="@drawable/zuo"
            android:layout_width="45dp"
            android:layout_height="45dp" />

        <TextView
            android:text="商品详情"
            android:textSize="30dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <CheckBox
            android:layout_marginLeft="140dp"
            android:button="@null"
            android:id="@+id/grid"
            android:background="@drawable/dian"
            android:layout_width="35dp"
            android:layout_height="35dp" />

    LinearLayout>

    <android.support.v7.widget.RecyclerView

        android:id="@+id/res"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">android.support.v7.widget.RecyclerView>
LinearLayout>


//activity_xiangqing

xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.bwie.test.moni.XiangqingActivity">
    <LinearLayout
        android:id="@+id/lin"
        android:layout_alignParentTop="true"
        android:background="#dbd9d9"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/zuo"
            android:background="@drawable/zuo"
            android:layout_width="30dp"
            android:layout_height="30dp" />
        <TextView
            android:gravity="center"
            android:text="商品详情"
            android:textSize="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    LinearLayout>
   <com.stx.xhb.xbanner.XBanner
       android:layout_below="@+id/lin"
       android:id="@+id/xb"
       android:layout_width="match_parent"
       android:layout_height="300dp">com.stx.xhb.xbanner.XBanner>
    <TextView
        android:layout_below="@+id/xb"
        android:id="@+id/tel"
        android:maxLines="2"
        android:minLines="2"
        android:textSize="18dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <TextView
        android:layout_below="@+id/tel"
        android:id="@+id/head"
        android:layout_marginTop="20dp"
        android:maxLines="2"
        android:minLines="2"
        android:textSize="18dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <TextView
        android:layout_marginTop="15dp"
        android:layout_below="@+id/head"
        android:id="@+id/yuanprice"

        android:textSize="18dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <TextView
        android:layout_marginTop="15dp"
        android:layout_below="@+id/yuanprice"
        android:id="@+id/price"
        android:textColor="#f00"
        android:textSize="18dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <Button
        android:layout_alignParentBottom="true"
        android:id="@+id/tianjia"
        android:text="添加购物车"
        android:textSize="25dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

RelativeLayout>



//gridbuju.xml

xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/img"
        android:layout_gravity="center"
        android:layout_width="130dp"
        android:layout_height="130dp" />

        <TextView
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_marginTop="5dp"
            android:id="@+id/price"
            android:textColor="#f00"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

LinearLayout>


//linbuju.xml

xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/img"
        android:layout_width="100dp"
        android:layout_height="100dp" />
    <LinearLayout
        android:layout_marginTop="10dp"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_marginTop="5dp"
            android:id="@+id/price"
            android:textColor="#f00"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    LinearLayout>
LinearLayout>



//drawable文件夹下_dian.xml

xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/kind_liner">item>
    <item android:state_checked="false" android:drawable="@drawable/kind_grid">item>
selector>


//sou.xml

xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    corners android:radius="30dp" />
    <solid android:color="#fff"/>
shape>


//textview_bg.xml

xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#666666"/>  
        <corners android:radius="10dp"/>  
    <padding
    android:left="5dp"
    android:right="5dp"
    android:top="5dp"
    android:bottom="5dp"/> 
shape>


//需要添加的依赖

compile files('libs/gson-2.6.2.jar')
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.xhb:xbanner:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okio:okio:1.11.0'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support.test:runner:0.5'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'


//需要添加的权限

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


<application
    android:name="com.bwie.test.utils.Inagoath"


    <activity android:name=".NeirongActivity"/>
    <activity android:name=".XiangqingActivity"/>
application>

你可能感兴趣的:(Android网络请求)