简单实现京东订单功能

本文主要介绍了如何简单实现京东订单功能,包括必要的网络权限设置、引入gson库的依赖,并给出了主页面布局的关键代码。
摘要由CSDN通过智能技术生成

提示      慎重复制


1  网络权限

2  导入依赖 

compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'

导gsonjar包

3代码


主页面布局

<?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" tools:context="com.example.zhangkai20180427.MainActivity"
    android:orientation="vertical"
    >
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >
    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="订单"
        android:layout_weight="9"
        android:layout_gravity="center"
        android:gravity="center"
        />
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/ic_launcher"
    android:layout_weight="1"
    android:id="@+id/btn"
    />

</LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="待支付"
            android:id="@+id/onefu"
            />
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="已支付"
            android:id="@+id/twofu"
            />
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="已取消"
            android:id="@+id/threefu"
            />
    </LinearLayout>
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/fram"
    ></FrameLayout>

</LinearLayout>


item布局/
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    >

   <RelativeLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/titledai"
            />
       <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/dai"
           android:layout_alignParentRight="true"
           />
   </RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:text="价格 : "
        android:id="@+id/ll"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/pricedai"
        android:layout_toRightOf="@+id/ll"
        />
</RelativeLayout>


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="创建时间:"
            android:id="@+id/yy"
            />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/yy"
    android:id="@+id/timedai"
    />


        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
              android:text="取消订单"
            android:layout_alignParentRight="true"
            android:id="@+id/btndai"
            />
    </RelativeLayout>
</LinearLayout>
第一个fragment的布局///
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/recycle1"
        ></android.support.v7.widget.RecyclerView>

</LinearLayout>
第二个fragment的布局///
<?xml version=
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值