仿京东订单

该博客介绍了如何构建一个仿京东订单系统,涉及到的关键技术包括RxJava2、Retrofit2、Fresco库以及ButterKnife注解处理器。博主详细列出了项目的依赖,并提到了涉及的XML布局文件如popupwindow、order_adapter_item等,以及关键的Java类如MainActivity、Fragment和数据模型类。此外,还讨论了网络请求接口、适配器和视图模型的实现。
摘要由CSDN通过智能技术生成

依赖

  compile "io.reactivex.rxjava2:rxjava:2.1.1"
  compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
  compile 'com.squareup.retrofit2:retrofit:2.3.0'
  compile 'com.squareup.retrofit2:converter-gson:2.3.0'
  compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
  compile 'com.facebook.fresco:fresco:+'
  compile 'com.facebook.fresco:animated-gif:+'
  compile 'com.jakewharton:butterknife:8.5.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
  compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
  compile 'com.android.support:design:+'
  compile 'com.squareup.okhttp3:logging-interceptor:3.9.1'


.xml代码

activity_main
<?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="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="订单页面"
            android:textSize="20sp" />

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:src="@mipmap/ic_launcher" />
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#000" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="50dp" />

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

popupwindow
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:orientation="vertical"
    android:paddingBottom="2dp">


    <TextView
        android:id="@+id/pop_computer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="待支付"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/pop_financial"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="已支付"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/pop_manage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="已取消"
        android:textSize="20sp" />

</LinearLayout>
order_adapter_item
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relative"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:orientation="vertical">

        <TextView
            android:id="@+id/titleView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:text="sada" />

        <TextView
            android:id="@+id/price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp"
            android:text="价格" />

        <TextView
            android:id="@+id/time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="时间" />


    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:orientation="vertical">

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="待支付"
            android:textColor="#f00" />

        <Button
            android:id="@+id/btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="待支付" />
    </LinearLayout>

</RelativeLayout>
fragment_one
<?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:id="@+id/recyclerFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>
fragment_twor
<?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:id="@+id/recyclerFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>
Android Studio是一款功能强大的集成开发环境,可以帮助开发者快速构建出高质量的安卓应用程序。 仿京东的安卓应用程序不仅需要具备京东商城的功能特点,还要考虑用户体验、界面设计、商品展示、购物流程等方面的细节。 首先,我们可以在Android Studio中创建一个新的安卓项目,然后选择合适的布局和组件来设计京东商城的首页界面。可以使用RecyclerView来展示商品列表,使用CardView来展示商品的详细信息,并通过ViewPager或者TabLayout来展示不同分类的商品。 其次,我们要考虑用户体验和交互性。可以使用Fragment来实现不同页面之间的切换,使用SharedPreferences来存储用户的购物车信息和历史浏览记录。 另外,可以使用Retrofit来进行网络请求,加载商品数据。 购物流程也是非常重要的一部分。在Android Studio中,我们可以通过编写代码来实现购物车功能,包括添加商品到购物车、商品结算等功能。同时,我们还可以利用第三方支付SDK来实现支付功能。 最后,还要考虑到应用的性能和稳定性。通过Android Studio的性能分析工具,可以检测应用的性能问题,并进行优化。另外,可以利用Firebase Crashlytics来监控应用的崩溃问题,以保证应用的稳定性。 总而言之,通过使用Android Studio,我们可以实现仿京东的安卓应用程序。并且可以通过不断学习和探索,进一步完善应用的功能和性能,给用户带来更好的使用体验。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值