电商图片上传

本文主要探讨电商领域中图片上传的实现过程,包括使用的网络工具类、参数拼接方法以及在Activity中的应用。
摘要由CSDN通过智能技术生成

xml

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

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/image_simple"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:src="@mipmap/ic_launcher" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:orientation="horizontal">

        <Button
            android:id="@+id/button_photo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="相机" />

        <Button
            android:id="@+id/button_xc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="相册" />

    </LinearLayout>

</LinearLayout>

网络工具类

package luwenjie0428.bw.com.luwenjie0502.model.util;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @author:
 * @ProjectName: Luwenjie0502
 * @Package: luwenjie0428.bw.c
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值