Android 项目购物车模块(全)

需要的依赖:

 

compile'com.facebook.fresco:fresco:0.14.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.google.code.gson:gson:2.2.4'

------------------------model----------------------------

 

--------------AddgoodListenert------------------------

 

package com.example.gouwuchelianxi.mode;

import com.example.gouwuchelianxi.bean.Addgood_bean;

public interface AddgoodListenert {
    void addgood(Addgood_bean addgood_bean);
}

---------------Getgoodshoplist-----------------------

 

 

package com.example.gouwuchelianxi.mode;

import com.example.gouwuchelianxi.bean.Goodshop_bean;

public interface Getgoodshoplist {
    void getgoodShoplisteneter(Goodshop_bean.DataBean data);
}

-------------Igoodshop---------------------------

 

 

package com.example.gouwuchelianxi.mode;

import com.example.gouwuchelianxi.bean.Good_bean;

import java.util.Map;

public interface Igoodshop {
    void getgoodshopjson(String uri, Map<String,String> map,Getgoodshoplist getgoodshoplist );
    //添加购物车
    void addgoogshop(String uri, Map<String,String> map,AddgoodListenert addgood);
    //二级列表购物车
    void getgoodshop(String uri, Map<String,String> map,Showgoos showgoos);

    //计算的方法
    double jisuan(Good_bean good_bean);
}

------------Mygoodshop----------------------

 

 

package com.example.gouwuchelianxi.mode;

import android.util.Log;

import com.example.gouwuchelianxi.bean.Addgood_bean;
import com.example.gouwuchelianxi.bean.Good_bean;
import com.example.gouwuchelianxi.bean.Goodshop_bean;
import com.example.gouwuchelianxi.util.Okhttpgetnet;
import com.google.gson.Gson;

import java.util.List;
import java.util.Map;

public class Mygoodshop implements Igoodshop {
     Okhttpgetnet okhttpgetnet=new Okhttpgetnet();
    @Override
    public void getgoodshopjson(String uri, Map<String,String> map, final Getgoodshoplist getgoodshoplist) {
        okhttpgetnet.getnetpost(uri,map);
        okhttpgetnet.setOnOKHttpGetListener(new Okhttpgetnet.OkhttpgetListener() {
            @Override
            public void error(String error) {

            }

            @Override
            public void success(String json) {
                Gson gson = new Gson();
                Goodshop_bean goodshop_bean = gson.fromJson(json, Goodshop_bean.class);

                Goodshop_bean.DataBean data = goodshop_bean.getData();

                getgoodshoplist.getgoodShoplisteneter(data);

            }
        });


    }

    @Override
    public void addgoogshop(String uri, Map<String, String> map, final AddgoodListenert addgood) {
        okhttpgetnet.getnetpost(uri,map);
        okhttpgetnet.setOnOKHttpGetListener(new Okhttpgetnet.OkhttpgetListener() {
            @Override
            public void error(String error) {

            }

            @Override
            public void success(String json) {
                Gson gson = new Gson();
                Addgood_bean addgood_bean = gson.fromJson(json, Addgood_bean.class);
                addgood.addgood(addgood_bean);
            }
        });
    }

    @Override
    public void getgoodshop(String uri, Map<String, String> map, final Showgoos showgoos) {
        okhttpgetnet.getnetpost(uri,map);
        okhttpgetnet.setOnOKHttpGetListener(new Okhttpgetnet.OkhttpgetListener() {
            @Override
            public void error(String error) {

            }

            @Override
            public void success(String json) {
                Gson gson = new Gson();
                Good_bean good_bean = gson.fromJson(json, Good_bean.class);

                showgoos.showGoodListenert(good_bean);
            }
        });

    }

    //计算的方法
    @Override
    public double jisuan(Good_bean good_bean) {
        //初始化变量
        double count = 0;
        //获取父控件的集合
        List<Good_bean.DataBean> data = good_bean.getData();
        //遍历获取子控件的集合
        for (int i = 0; i <data.size() ; i++) {
            List<Good_bean.Mygood> list = data.get(i).getList();
            //遍历获取子控件的价格
            for (int j = 0; j < list.size(); j++) {

                //如果复选框为true时   计算
                if (list.get(j).getChildselect()) {
                    int count1 = list.get(j).getCount()+1;
                    Log.d("计算", "jisuan: "+count1);
                    double price = list.get(j).getPrice()*count1;
                    count += price;
                }
            }
        }
        return count;
    }
}

------------Neturi-----------------------

 

 

package com.example.gouwuchelianxi.mode;

public interface Neturi {
      String good="https://www.zhaoapi.cn/product/getProductDetail";
      String addgood="https://www.zhaoapi.cn/product/addCart";
      String showgood="https://www.zhaoapi.cn/product/getCarts";
}

--------------Showgoos---------------------

 

 

package com.example.gouwuchelianxi.mode;

import com.example.gouwuchelianxi.bean.Good_bean;

public interface Showgoos {
    void showGoodListenert( Good_bean good_bean );
}

 

 

 

------------------------view----------------------------

------------Animation_activity---------------

 

package com.example.gouwuchelianxi.view;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.DisplayMetrics;

import com.example.gouwuchelianxi.R;
import com.facebook.drawee.view.SimpleDraweeView;

public class Animation_activity extends Activity {

    private SimpleDraweeView sd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.animation_nain);
       sd = findViewById(R.id.sd);
      sd.setImageURI(Uri.parse("res://com.example.gouwuchelianxi/"+R.drawable.b));
        sd = findViewById(R.id.sd);
     DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        int heightPixels = displayMetrics.heightPixels;
        ObjectAnimator translationY = ObjectAnimator.ofFloat(sd, "translationY", 0, heightPixels / 2 - 100);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(sd, "scaleX", 2.0f, 1.0f);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(sd, "scaleY", 2.0f, 1.0f);
        ObjectAnimator alpha = ObjectAnimator.ofFloat(sd, "alpha", 0.1f, 1f);
        ObjectAnimator rotation = ObjectAnimator.ofFloat(sd, "rotation", 0, 360);

        AnimatorSet set=new AnimatorSet();
        set.playTogether(translationY,scaleX,scaleY,alpha,rotation);
        set.setDuration(3000);
        set.start();

       set.addListener(new AnimatorListenerAdapter() {
           @Override
           public void onAnimationEnd(Animator animation) {
               super.onAnimationEnd(animation);
               startActivity(new Intent(Animation_activity.this,MainActivity.class));
               overridePendingTransition(R.anim.start,R.anim.end);
               finish();
           }
       });
    }
}

------------Ishow-------------------

 

 

package com.example.gouwuchelianxi.view;

import android.content.Context;
import android.widget.TextView;

import com.example.gouwuchelianxi.bean.Good_bean;


public interface Ishow {
    void mysetadapter(Context context,Good_bean good_bean);
    //计算价格的方法
    void suan(TextView sum,double count);

}

------------Ishowgood------------------

 

 

package com.example.gouwuchelianxi.view;

import com.example.gouwuchelianxi.bean.Goodshop_bean;


public interface Ishowgood {
    void show(Goodshop_bean.DataBean data);
    //添加购物车的方法
    String addshop();
    //添加购物车成功吐司
    void addshopcheng(String cheng);
      // 跳转的方法
    void jump();

}

-----------MainActivity------------------

 

 

package com.example.gouwuchelianxi.view;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.example.gouwuchelianxi.Presenter.Myshowgood;
import com.example.gouwuchelianxi.R;
import com.example.gouwuchelianxi.bean.Goodshop_bean;
import com.example.gouwuchelianxi.mode.Mygoodshop;
import com.facebook.drawee.view.SimpleDraweeView;

public class MainActivity extends AppCompatActivity implements Ishowgood,View.OnClickListener{

    private SimpleDraweeView s_sd;
    private TextView name;
    private TextView price;
    private TextView price1;
    private TextView addshop;
    private TextView addshop1;
    private TextView shoushop;
    private Goodshop_bean.DataBean data;
    private Myshowgood myshowgood;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myshowgood = new Myshowgood();
        myshowgood.getmv(this,new Mygoodshop());
        initializeid();
        name.setOnClickListener(this);
        addshop1.setOnClickListener(this);
        shoushop.setOnClickListener(this);
    }

    private void initializeid() {
        s_sd = findViewById(R.id.s_sd);
        name = findViewById(R.id.name);
        price = findViewById(R.id.price);
        price1 = findViewById(R.id.price1);
        addshop1 = findViewById(R.id.addshop);
        shoushop = findViewById(R.id.shoushop);
    }

    @Override
    public void show(final Goodshop_bean.DataBean data) {
        this.data=data;
        String images = data.getImages();
        String[] split = images.split(".jpg");
        s_sd.setImageURI(Uri.parse(split[0]+".jpg"));
        name.setText(data.getTitle());
        price.setText(data.getSalenum()+"");
        price.setText(data.getPrice()+"");
        s_sd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this, Webacticuty.class);
                intent.putExtra("web",data.getDetailUrl());
                startActivity(intent);
            }
        });
    }

    @Override
    public String addshop() {
        int pid = data.getPid();
      return pid+"";
    }

    @Override
    public void addshopcheng(String cheng) {
        Toast.makeText(MainActivity.this,cheng,Toast.LENGTH_SHORT).show();
    }

    @Override
    public void jump() {
     startActivity(new Intent(MainActivity.this,Show.class));
    }

    @Override
    public void onClick(View v) {
           switch (v.getId()) {
               //添加购物车
                 case R.id.addshop:
                     myshowgood.addshop(this,new Mygoodshop());
                    break;
                    case R.id.shoushop:
                            myshowgood.jumpshow(this,new Mygoodshop());
                    break;
                 }
          }
       }

-------------Show--------------------

 

 

package com.example.gouwuchelianxi.view;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ExpandableListView;
import android.widget.TextView;
import com.example.gouwuchelianxi.Presenter.Myadapter;
import com.example.gouwuchelianxi.Presenter.Myshowgood;
import com.example.gouwuchelianxi.R;
import com.example.gouwuchelianxi.bean.Good_bean;
import com.example.gouwuchelianxi.mode.Mygoodshop;
import java.util.List;


public class Show extends Activity implements Ishow,View.OnClickListener{

    private ExpandableListView exlistview;
    private TextView sum;
    private CheckBox qf;
    private Good_bean good_bean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.show);
        exlistview = findViewById(R.id.exlistview);
        sum = findViewById(R.id.sum);
        qf = findViewById(R.id.qf);
        qf.setOnClickListener(this);
        Myshowgood myshowgood=new Myshowgood();
        myshowgood.showgoodsshop(this,this,new Mygoodshop());

    }

    @Override
    public void mysetadapter(Context context, Good_bean good_bean) {
        List<Good_bean.DataBean> list = good_bean.getData();
        Myadapter myadapter=new Myadapter(context,good_bean,list,sum);
        exlistview.setAdapter(myadapter);
        //获取购物车对象  全选反选时用
        this.good_bean=good_bean;

        //默认让其全部展开
        for (int i = 0; i < list.size(); i++) {
            exlistview.expandGroup(i);
        }
    }

    @Override
    public void suan(TextView sum,double count) {
        sum.setText("总价:"+count);

    }

    @Override
    public void onClick(View v) {
        //获取购物车对象
        List<Good_bean.DataBean> data = good_bean.getData();
        for (int i = 0; i <data.size() ; i++) {
            //设置父控件取反
            data.get(i).setPrentflog(!data.get(i).getPrentflog());
            //获取子控件
            List<Good_bean.Mygood> list = data.get(i).getList();
            for (int j = 0; j <list.size() ; j++) {
                //设置子控件取反
                list.get(j).setChildselect(!list.get(j).getChildselect());
            }
        }

        //最后调用计算价格的方法
     Myshowgood myshowgood=new Myshowgood();
        myshowgood.textcount(new Show(),new Mygoodshop(),good_bean,sum);
    }
}

-----------Webacticuty------------------

 

 

package com.example.gouwuchelianxi.view;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.example.gouwuchelianxi.R;

public class Webacticuty extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.web_view);
       WebView wb= findViewById(R.id.wb);
        Intent intent = getIntent();
        String web = intent.getStringExtra("web");
        Log.d("web", web);
        wb.loadUrl(web);
        wb.setWebViewClient(new WebViewClient());

    }
}

 

 

 

------------------------presenter----------------------------

------------Ipshowgood----------------

 

package com.example.gouwuchelianxi.Presenter;

import android.content.Context;
import android.widget.TextView;
import com.example.gouwuchelianxi.bean.Good_bean;
import com.example.gouwuchelianxi.mode.Igoodshop;
import com.example.gouwuchelianxi.view.Ishow;
import com.example.gouwuchelianxi.view.Ishowgood;

public interface Ipshowgood {
    void getmv(Ishowgood ishowgood, Igoodshop igoodshop);
    void addshop(Ishowgood ishowgood, Igoodshop igoodshop);
    //跳转
    void jumpshow(Ishowgood ishowgood, Igoodshop igoodshop);
    void showgoodsshop(Context content, Ishow ishow, Igoodshop igoodshop);
    //计算的方法  需要购物车对象
    void textcount(Ishow ishow, Igoodshop igoodshop, Good_bean good_bean, TextView sum);

}

-----------Myadapter--------------------------

 

 

package com.example.gouwuchelianxi.Presenter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.gouwuchelianxi.R;
import com.example.gouwuchelianxi.bean.Good_bean;
import com.example.gouwuchelianxi.mode.Mygoodshop;
import com.example.gouwuchelianxi.view.Show;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;

public class Myadapter extends BaseExpandableListAdapter {
    private Context context;
    private Good_bean good_bean;
    private List<Good_bean.DataBean> list;
     private TextView sum;

    public Myadapter(Context context, Good_bean good_bean, List<Good_bean.DataBean> list,TextView sum) {
        this.context = context;
        this.good_bean = good_bean;
        this.list = list;
        this.sum=sum;
    }



    @Override
    public int getGroupCount() {

        return list.size();
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        return list.get(groupPosition).getList().size();
    }

    @Override
    public Object getGroup(int groupPosition) {

        return list.get(groupPosition);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return list.get(groupPosition).getList().get(childPosition);
    }

    @Override
    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

        Myprenthodler myprenthodler;
        if (convertView==null){
            convertView = View.inflate(context, R.layout.show_prent, null);
            CheckBox prent_ck = convertView.findViewById(R.id.prent_ck);
            TextView prent_tv = convertView.findViewById(R.id.prent_tv);
            myprenthodler = new Myprenthodler(prent_ck, prent_tv);
            convertView.setTag(myprenthodler);
        }else {
            myprenthodler= (Myprenthodler) convertView.getTag();
        }

        myprenthodler.getPrent_tv().setText(list.get(groupPosition).getSellerName());
        Good_bean.DataBean dataBean = list.get(groupPosition);

        myprenthodler.getPrent_ck().setChecked(dataBean.getPrentflog());

        //父控件的点击事件
        myprenthodler.getPrent_ck().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //获取父控件  自己定义的布尔值
                boolean isCheked = list.get(groupPosition).getPrentflog();
                //点击的时候置反
                isCheked=!isCheked;

                //设置父控件   点击置反
                list.get(groupPosition).setPrentflog(isCheked);

                //获取子控件的集合
                    List<Good_bean.Mygood> list = Myadapter.this.list.get(groupPosition).getList();
                    for (int i = 0; i < list.size(); i++) {
                        //设置子控件和父父控件相同的布尔值
                        list.get(i).setChildselect(isCheked);

                    //通知界面刷新
                    notifyDataSetChanged();

                    //调用计算的方法
                        Myshowgood myshowgood=new Myshowgood();
                        myshowgood.textcount(new Show(),new Mygoodshop(),good_bean,sum);
                }
            }
        });


        return convertView;
    }

    @Override
    public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        final Mychildhodler mychildhodler;
        if (convertView==null){
           convertView = View.inflate(context, R.layout.show_chiled, null);
           CheckBox child_ck = convertView.findViewById(R.id.child_ck);
          TextView cjild_name = convertView.findViewById(R.id.cjild_name);
           TextView cjild_price = convertView.findViewById(R.id.cjild_price);
            SimpleDraweeView child_sd = convertView.findViewById(R.id.child_sd);

          ImageView jian = convertView.findViewById(R.id.jian);
           ImageView jia = convertView.findViewById(R.id.jia);
          EditText ed = convertView.findViewById(R.id.ed);

           mychildhodler = new Mychildhodler(child_ck,cjild_name,cjild_price,child_sd,ed,jia,jian);
           convertView.setTag(mychildhodler);
       }else {
           mychildhodler= (Mychildhodler) convertView.getTag();
       }
       //获取图片的uri   拆分取第一个
        String images = list.get(groupPosition).getList().get(childPosition).getImages();
        String[] split = images.split(".jpg");
        mychildhodler.cjild_name.setText(list.get(groupPosition).getList().get(childPosition).getTitle());
       mychildhodler.cjild_price.setText(list.get(groupPosition).getList().get(childPosition).getPrice()+"");
       //拼接字符串为图片赋值
        mychildhodler.getChild_sd().setImageURI(split[0]+".jpg");
        //为复选框设置 自己定义的布尔值
        mychildhodler.child_ck.setChecked(list.get(groupPosition).getList().get(childPosition).getChildselect());

        //为文本框赋值
        Good_bean.Mygood mygood = list.get(groupPosition).getList().get(childPosition);
        //自己定义属性count默认为0   赋值时需要+1
        mychildhodler.ed.setText(mygood.getCount()+1+"");

        //自控件的点击事件
        mychildhodler.child_ck.setOnClickListener(new View.OnClickListener() {


            @Override
            public void onClick(View v) {
                //获取自定义子控件的布尔值
                boolean isCheked = list.get(groupPosition).getList().get(childPosition).getChildselect();
                //点击时置反
                isCheked=!isCheked;

                //给子控件复选框赋值  目的为了记录复选框的值
                list.get(groupPosition).getList().get(childPosition).setChildselect(isCheked);

                //当前类名调出  子控件的集合
                List<Good_bean.Mygood> list1 = Myadapter.this.list.get(groupPosition).getList();
                //设置标识位
                boolean flag = true;
                //遍历子控件的集合
               for (int i = 0; i < list1.size(); i++) {
                   //如果子控件有一个的值为false时  父控件的值为false  否则不走if判断  父控件为true
                    if (!list1.get(i).getChildselect()){
                        flag=false;
                    }
                }
             //设置父控件的值
                Myadapter.this.list.get(groupPosition).setPrentflog(flag);


                //通知改变
                notifyDataSetChanged();


                //调用p层计算的方法    把购车车对象传过去  便于获取数据
                //计算的逻辑在m层做  返回一个double  在p层调用v层的方法把m层计算好的值赋值给textview
                Myshowgood myshowgood=new Myshowgood();
                myshowgood.textcount(new Show(),new Mygoodshop(),good_bean,sum);


            }
        });


       //加减的点击事件     加的事件
        mychildhodler.getJia().setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                int count = list.get(groupPosition).getList().get(childPosition).getCount();
                list.get(groupPosition).getList().get(childPosition).setCount(++count);

                Myshowgood myshowgood=new Myshowgood();
                int gcount = list.get(groupPosition).getList().get(childPosition).getCount();
                myshowgood.textcount(new Show(),new Mygoodshop(),good_bean,sum);
                notifyDataSetChanged();

            }
        });

        //点击减的事件
        mychildhodler.getJian().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                int count = list.get(groupPosition).getList().get(childPosition).getCount();

                if (count>0) {
                    count--;
                    list.get(groupPosition).getList().get(childPosition).setCount(count);
                }else{
                    Toast.makeText(context,"不能再减了",Toast.LENGTH_SHORT).show();
                }
                //调用计算的方法  p层
                Myshowgood myshowgood=new Myshowgood();
                myshowgood.textcount(new Show(),new Mygoodshop(),good_bean,sum);
                notifyDataSetChanged();
            }
        });

        return convertView;

    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return false;
    }
    //子控件的优化类   set  get   有参构造
    class Mychildhodler{
        private CheckBox child_ck;
        private TextView cjild_name;
        private TextView cjild_price;
        private  SimpleDraweeView child_sd;
        private  EditText ed;
        private ImageView jia;
        private ImageView jian;

        public Mychildhodler(CheckBox child_ck, TextView cjild_name, TextView cjild_price, SimpleDraweeView child_sd, EditText ed, ImageView jia, ImageView jian) {
            this.child_ck = child_ck;
            this.cjild_name = cjild_name;
            this.cjild_price = cjild_price;
            this.child_sd = child_sd;
            this.ed = ed;
            this.jia = jia;
            this.jian = jian;
        }

        public ImageView getJia() {
            return jia;
        }

        public void setJia(ImageView jia) {
            this.jia = jia;
        }

        public ImageView getJian() {
            return jian;
        }

        public void setJian(ImageView jian) {
            this.jian = jian;
        }

        public EditText getEd() {
            return ed;
        }

        public void setEd(EditText ed) {
            this.ed = ed;
        }

        public Mychildhodler(CheckBox child_ck, TextView cjild_name, TextView cjild_price, SimpleDraweeView child_sd, EditText ed) {
            this.child_ck = child_ck;
            this.cjild_name = cjild_name;
            this.cjild_price = cjild_price;
            this.child_sd = child_sd;
            this.ed = ed;
        }

        public CheckBox getChild_ck() {
            return child_ck;
        }

        public void setChild_ck(CheckBox child_ck) {
            this.child_ck = child_ck;
        }

        public TextView getCjild_name() {
            return cjild_name;
        }

        public void setCjild_name(TextView cjild_name) {
            this.cjild_name = cjild_name;
        }

        public TextView getCjild_price() {
            return cjild_price;
        }

        public void setCjild_price(TextView cjild_price) {
            this.cjild_price = cjild_price;
        }

        public SimpleDraweeView getChild_sd() {
            return child_sd;
        }

        public void setChild_sd(SimpleDraweeView child_sd) {
            this.child_sd = child_sd;
        }


    }

    //父控件的优化类   set  get   有参构造
    class Myprenthodler{
        private CheckBox prent_ck;
        private TextView prent_tv;


        public CheckBox getPrent_ck() {
            return prent_ck;
        }

        public void setPrent_ck(CheckBox prent_ck) {
            this.prent_ck = prent_ck;
        }

        public TextView getPrent_tv() {
            return prent_tv;
        }

        public void setPrent_tv(TextView prent_tv) {
            this.prent_tv = prent_tv;
        }

        public Myprenthodler(CheckBox prent_ck, TextView prent_tv) {

            this.prent_ck = prent_ck;
            this.prent_tv = prent_tv;
        }
    }
}

 

------------------Myshowgood----------------

 

 

 

package com.example.gouwuchelianxi.Presenter;

import android.content.Context;
import android.widget.TextView;
import com.example.gouwuchelianxi.bean.Addgood_bean;
import com.example.gouwuchelianxi.bean.Good_bean;
import com.example.gouwuchelianxi.bean.Goodshop_bean;
import com.example.gouwuchelianxi.mode.AddgoodListenert;
import com.example.gouwuchelianxi.mode.Getgoodshoplist;
import com.example.gouwuchelianxi.mode.Igoodshop;
import com.example.gouwuchelianxi.mode.Neturi;
import com.example.gouwuchelianxi.mode.Showgoos;
import com.example.gouwuchelianxi.view.Ishow;
import com.example.gouwuchelianxi.view.Ishowgood;
import java.util.HashMap;
import java.util.Map;


public class Myshowgood implements Ipshowgood {
    @Override
    public void getmv(final Ishowgood ishowgood, Igoodshop igoodshop) {
        Map<String,String> map=new HashMap<>();
        map.put("pid","71");
        igoodshop.getgoodshopjson(Neturi.good, map, new Getgoodshoplist() {
            @Override
            public void getgoodShoplisteneter(Goodshop_bean.DataBean data) {
                ishowgood.show(data);

            }
        });
    }
   //添加购物车的方法
    @Override
    public void addshop(final Ishowgood ishowgood, Igoodshop igoodshop) {
        Map<String,String> map=new HashMap<>();
        map.put("pid","71");
        map.put("uid",ishowgood.addshop());
        igoodshop.addgoogshop(Neturi.addgood, map, new AddgoodListenert() {
            @Override
            public void addgood(Addgood_bean addgood_bean) {
               if (addgood_bean.getCode().equals("0")){
                   ishowgood.addshopcheng("成功");
                   ishowgood.jump();
               }
            }
        });

    }

    @Override
    public void jumpshow(Ishowgood ishowgood, Igoodshop igoodshop) {
        ishowgood.jump();
    }

    //查询购物车二级列表的方法
    @Override
    public void showgoodsshop(final Context content, final Ishow ishow, Igoodshop igoodshop) {
        Map<String,String> map=new HashMap<>();
        map.put("uid","71");
        igoodshop.getgoodshop(Neturi.showgood, map, new Showgoos() {
            @Override
            public void showGoodListenert( Good_bean good_bean ) {
                ishow.mysetadapter(content,good_bean);
            }
        });
    }

    //计算的方法   sum为计算文本的id      good_bean为v层传过来的购物车数据的对象  sum为总价的id
    @Override
    public void textcount(Ishow ishow, Igoodshop igoodshop, Good_bean good_bean, TextView sum) {

       //调用m层计算的方法   返回结果值
        double jisuan = igoodshop.jisuan(good_bean);
        ishow.suan(sum,jisuan);
    }


}

------------------------util-------------------------------

 

--------------Myapp----------------------

 

package com.example.gouwuchelianxi.util;

import android.app.Application;

import com.facebook.drawee.backends.pipeline.Fresco;

public class Myapp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Fresco.initialize(this);
    }
}

-----------------Okhttpgetnet--------------------

 

 

package com.example.gouwuchelianxi.util;

import android.os.Handler;
import android.os.Message;
import java.io.IOException;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class Okhttpgetnet {
      public static Okhttpgetnet okposthttp = null;
               public static Okhttpgetnet getInstance() {

                   if (okposthttp == null) {
                       okposthttp = new Okhttpgetnet();
                   }
                   return okposthttp;
               }
                Handler handler=new Handler(){
                        @Override
                        public void handleMessage(Message msg) {
                            int i=msg.what;
                            //等于0失败
                            if (i==0){
                                String shi = (String) msg.obj;
                                okhttpgetListener.error(shi);
                            }
                            //等于1成功
                            if (i==1){
                                String json = (String) msg.obj;
                                okhttpgetListener.success(json);
                            }
                        }
                    };
                    private OkhttpgetListener okhttpgetListener;

                    public void getnetpost(String url,Map<String, String> params){
                        OkHttpClient okHttpClient = new OkHttpClient.Builder().addInterceptor(new MyInter()).build();

                        //3.x版本post请求换成FormBody 封装键值对参数
                        FormBody.Builder builder = new FormBody.Builder();

                        for (String key : params.keySet()) {
                            builder.add(key, params.get(key));
                        }

                        Request request = new Request.Builder().url(url).post(builder.build()).build();
                        Call call = okHttpClient.newCall(request);

                        call.enqueue(new Callback() {
                            @Override
                            public void onFailure(Call call, IOException e) {
                                Message message=new Message();
                                message.obj="处理失败";
                                message.what=0;
                                handler.sendMessage(message);
                            }

                            @Override
                            public void onResponse(Call call, Response response) throws IOException {
                                String string = response.body().string();
                                Message message=new Message();
                                message.obj=string;
                                message.what=1;
                                handler.sendMessage(message);
                            }
                        });
                    }

                    public interface OkhttpgetListener{
                        //失败的方法
                        void error(String error);
                        //成功的方法
                        void success(String json);
                    }

                    //主线程获取网络解析后json的方法
                    public void setOnOKHttpGetListener(OkhttpgetListener okhttpgetListener){
                        this.okhttpgetListener=okhttpgetListener;
                    }

               public void okgetnet(String url){
                   OkHttpClient okHttpClient = new OkHttpClient.Builder().addInterceptor(new MyInter()).build();
                   //创建请求对象
                   Request request = new Request.Builder().url(url).build();
                   //创建Call请求队列
                   //请求都是放到一个队列里面的
                   Call call = okHttpClient.newCall(request);
                   //开始请求
                   call.enqueue(new Callback() {
                       //处理失败的方法
                       @Override
                       public void onFailure(Call call, IOException e) {
                           Message message=new Message();
                           message.obj="处理失败";
                           message.what=0;
                           handler.sendMessage(message);
                       }
                       //处理成功的方法
                       @Override
                       public void onResponse(Call call, Response response) throws IOException {
                           String string = response.body().string();
                           Message message=new Message();
                           message.obj=string;
                           message.what=1;
                           handler.sendMessage(message);

                       }
                   });
               }

          //拦截器
          class MyInter implements Interceptor {
              @Override
              public Response intercept(Chain chain) throws IOException {
                  //获取原来的body
                  Request request = chain.request();
                  RequestBody body = request.body();
                  if (body instanceof FormBody) {
                      //遍历原来的所有参数,加到新的Body里面,最后将公共参数加到新的Body
                      FormBody.Builder newBuilder = new FormBody.Builder();
                      for (int i = 0; i < ((FormBody) body).size(); i++) {
                          String name = ((FormBody) body).name(i);
                          String value = ((FormBody) body).value(i);

                          //放入新的
                          newBuilder.add(name, value);
                      }
                      //在将公共参数添加进去
                      newBuilder.add("source", "android");
                      FormBody newBody = newBuilder.build();
                      //创建新的请求
                      Request newRequest = request.newBuilder().post(newBody).build();
                      Response response = chain.proceed(newRequest);
                      return response;
                  }

                  return null;
              }
          }
}

--------------------------------bean---------------------------------

 

------------------Addgood_bean------------------------

 

package com.example.gouwuchelianxi.bean;

public class Addgood_bean {

    /**
     * msg : 天呢!用户未登录或用户id不能为空
     * code : 1
     */

    private String msg;
    private String code;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}

------------------Good_bean----------------------

 

 

package com.example.gouwuchelianxi.bean;

import java.util.List;

public class Good_bean {


    private String msg;
    private String code;
    private List<DataBean> data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        private boolean prentflog;
        private String sellerName;
        private String sellerid;
        private List<Mygood> list;

        public DataBean(boolean prentflog, String sellerName, String sellerid, List<Mygood> list) {
            this.prentflog = prentflog;
            this.sellerName = sellerName;
            this.sellerid = sellerid;
            this.list = list;
        }

        public boolean getPrentflog() {
            return prentflog;
        }

        public void setPrentflog(boolean prentflog) {
            this.prentflog = prentflog;
        }

        public String getSellerName() {
            return sellerName;
        }


        public void setSellerName(String sellerName) {
            this.sellerName = sellerName;
        }

        public String getSellerid() {
            return sellerid;
        }

        public void setSellerid(String sellerid) {
            this.sellerid = sellerid;
        }

        public List<Mygood> getList() {
            return list;
        }

        public void setList(List<Mygood> list) {
            this.list = list;
        }
    }
   public class Mygood{


        /**
         * bargainPrice : 22.9
         * createtime : 2017-10-14T21:48:08
         * detailUrl : https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends
         * images : https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg
         * num : 2
         * pid : 24
         * price : 288
         * pscid : 2
         * selected : 0
         * sellerid : 1
         * subhead : 三只松鼠零食特惠,专区满99减50,满199减100,火速抢购》
         * title : 三只松鼠 坚果炒货 零食奶油味 碧根果225g/袋
         */

        private double bargainPrice;
        private String createtime;
        private String detailUrl;
        private String images;
        private double num;
        private double pid;
        private double price;
        private double pscid;
        private double selected;
        private double sellerid;
        private String subhead;
        private String title;
        private int count;

       public int getCount() {
           return count;
       }

       public void setCount(int count) {
           this.count = count;
       }

       private boolean childselect;

       public boolean getChildselect() {
           return childselect;
       }

       public void setChildselect(boolean childselect) {
           this.childselect = childselect;
       }

       public Mygood(boolean childselect, double bargainPrice, String createtime, String detailUrl, String images, int num, int pid, int price, int pscid, int selected, int sellerid, String subhead, String title) {
           this.childselect = childselect;
           this.bargainPrice = bargainPrice;
           this.createtime = createtime;
           this.detailUrl = detailUrl;
           this.images = images;
           this.num = num;
           this.pid = pid;
           this.price = price;
           this.pscid = pscid;
           this.selected = selected;
           this.sellerid = sellerid;
           this.subhead = subhead;
           this.title = title;
       }

       public double getBargainPrice() {
            return bargainPrice;
        }

        public void setBargainPrice(double bargainPrice) {
            this.bargainPrice = bargainPrice;
        }

        public String getCreatetime() {
            return createtime;
        }

        public void setCreatetime(String createtime) {
            this.createtime = createtime;
        }

        public String getDetailUrl() {
            return detailUrl;
        }

        public void setDetailUrl(String detailUrl) {
            this.detailUrl = detailUrl;
        }

        public String getImages() {
            return images;
        }

        public void setImages(String images) {
            this.images = images;
        }

        public double getNum() {
            return num;
        }

        public void setNum(int num) {
            this.num = num;
        }

        public double getPid() {
            return pid;
        }

        public void setPid(int pid) {
            this.pid = pid;
        }

        public double getPrice() {
            return price;
        }

        public void setPrice(int price) {
            this.price = price;
        }

        public double getPscid() {
            return pscid;
        }

        public void setPscid(int pscid) {
            this.pscid = pscid;
        }

        public double getSelected() {
            return selected;
        }

        public void setSelected(int selected) {
            this.selected = selected;
        }

        public double getSellerid() {
            return sellerid;
        }

        public void setSellerid(int sellerid) {
            this.sellerid = sellerid;
        }

        public String getSubhead() {
            return subhead;
        }

        public void setSubhead(String subhead) {
            this.subhead = subhead;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }
    }
}

--------------------Goodshop_bean----------------------

 

 

package com.example.gouwuchelianxi.bean;

public class Goodshop_bean {

    /**
     * msg :
     * seller : {"description":"我是商家15","icon":"http://120.27.23.105/images/icon.png","name":"商家15","productNums":999,"score":5,"sellerid":15}
     * code : 0
     * data : {"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":71,"price":32999,"pscid":40,"salenum":4242,"sellerid":15,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"}
     */

    private String msg;
    private SellerBean seller;
    private String code;
    private DataBean data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public SellerBean getSeller() {
        return seller;
    }

    public void setSeller(SellerBean seller) {
        this.seller = seller;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class SellerBean {
        /**
         * description : 我是商家15
         * icon : http://120.27.23.105/images/icon.png
         * name : 商家15
         * productNums : 999
         * score : 5
         * sellerid : 15
         */

        private String description;
        private String icon;
        private String name;
        private int productNums;
        private int score;
        private int sellerid;

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getProductNums() {
            return productNums;
        }

        public void setProductNums(int productNums) {
            this.productNums = productNums;
        }

        public int getScore() {
            return score;
        }

        public void setScore(int score) {
            this.score = score;
        }

        public int getSellerid() {
            return sellerid;
        }

        public void setSellerid(int sellerid) {
            this.sellerid = sellerid;
        }
    }

    public static class DataBean {
        /**
         * bargainPrice : 11800
         * createtime : 2017-10-03T23:53:28
         * detailUrl : https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1
         * images : https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg
         * itemtype : 0
         * pid : 71
         * price : 32999
         * pscid : 40
         * salenum : 4242
         * sellerid : 15
         * subhead : 购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)
         * title : 全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G
         */

        private int bargainPrice;
        private String createtime;
        private String detailUrl;
        private String images;
        private int itemtype;
        private int pid;
        private int price;
        private int pscid;
        private int salenum;
        private int sellerid;
        private String subhead;
        private String title;

        public int getBargainPrice() {
            return bargainPrice;
        }

        public void setBargainPrice(int bargainPrice) {
            this.bargainPrice = bargainPrice;
        }

        public String getCreatetime() {
            return createtime;
        }

        public void setCreatetime(String createtime) {
            this.createtime = createtime;
        }

        public String getDetailUrl() {
            return detailUrl;
        }

        public void setDetailUrl(String detailUrl) {
            this.detailUrl = detailUrl;
        }

        public String getImages() {
            return images;
        }

        public void setImages(String images) {
            this.images = images;
        }

        public int getItemtype() {
            return itemtype;
        }

        public void setItemtype(int itemtype) {
            this.itemtype = itemtype;
        }

        public int getPid() {
            return pid;
        }

        public void setPid(int pid) {
            this.pid = pid;
        }

        public int getPrice() {
            return price;
        }

        public void setPrice(int price) {
            this.price = price;
        }

        public int getPscid() {
            return pscid;
        }

        public void setPscid(int pscid) {
            this.pscid = pscid;
        }

        public int getSalenum() {
            return salenum;
        }

        public void setSalenum(int salenum) {
            this.salenum = salenum;
        }

        public int getSellerid() {
            return sellerid;
        }

        public void setSellerid(int sellerid) {
            this.sellerid = sellerid;
        }

        public String getSubhead() {
            return subhead;
        }

        public void setSubhead(String subhead) {
            this.subhead = subhead;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }
    }
}

----------------------activity_main.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="com.example.gouwuchelianxi.view.MainActivity">

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

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="返回"
            android:textSize="40px" />

        <TextView
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:text="商品详情"
            android:textSize="40px" />
    </LinearLayout>

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/s_sd"
        android:layout_width="770px"
        android:layout_height="680px" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0px"
        android:layout_marginLeft="50px"
        android:layout_marginTop="30px"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30px"
            android:text="手机"
            android:textSize="30px" />

        <TextView
            android:id="@+id/price"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30px"
            android:text="手机"
            android:textSize="30px" />

        <TextView
            android:id="@+id/price1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30px"
            android:text="手机"
            android:textSize="30px" />
    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1px"
        android:background="#DCD9D4"></View>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/shoushop"
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:text="购物车"
            android:textSize="50px" />

        <View
            android:layout_width="3px"
            android:layout_height="match_parent"
            android:background="#DCD9D4"></View>

        <TextView
            android:id="@+id/addshop"
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:text="加入购物车"
            android:textSize="50px" />

    </LinearLayout>
</LinearLayout>

-----------------animation_nain.xml---------------------------

 

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical"
    android:gravity="center_horizontal"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

<com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="200px"
        android:layout_height="200px"
        android:id="@+id/sd"
       app:roundAsCircle="true"
         >
</com.facebook.drawee.view.SimpleDraweeView>



</LinearLayout>

-----------------------show.xml-------------------------

 

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent">
   <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="购物车"
        android:textSize="50px"
        android:layout_gravity="center_horizontal"/>

    <!--去除指针-->
    <ExpandableListView
        android:groupIndicator="@null"
        android:id="@+id/exlistview"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="match_parent"
        ></ExpandableListView>

         <View
             android:layout_width="match_parent"
             android:layout_height="1px"
             android:background="#DFDCD7"></View>
    <LinearLayout
        android:layout_gravity="center_vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <CheckBox
            android:layout_marginLeft="20px"
            android:id="@+id/qf"
            android:textSize="30px"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="全选/反选"/>

        <TextView
            android:textColor="#ff0000"
            android:id="@+id/sum"
            android:textSize="30px"
            android:layout_marginLeft="360px"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="0"/>

    </LinearLayout>


</LinearLayout>

------------------show_chiled.xml-------------------------

 

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:orientation="vertical"
    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="wrap_content"
         android:orientation="horizontal">
         <CheckBox
             android:focusable="false"
             android:layout_gravity="center_vertical"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:id="@+id/child_ck"/>
          <com.facebook.drawee.view.SimpleDraweeView
              android:layout_marginLeft="50px"
              android:layout_width="200px"
              android:layout_height="300px"
              android:id="@+id/child_sd"/>
         <LinearLayout
             android:layout_marginLeft="20px"
             android:layout_gravity="center_vertical"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:orientation="vertical">
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:id="@+id/cjild_name"
                 android:text="你好啊我来拉别跑啊"/>
             <TextView
                 android:layout_marginTop="60px"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:id="@+id/cjild_price"
                 android:text="你好啊我来拉别跑啊"/>


         </LinearLayout>

         <LinearLayout
             android:layout_marginLeft="-150dp"
             android:layout_marginTop="180px"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:orientation="horizontal">

             <ImageView
                 android:focusable="false"
                 android:id="@+id/jian"
                 android:layout_width="40px"
                 android:layout_height="40px"
                 android:src="@drawable/shopcart_minus_grey"/>
             <EditText
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:id="@+id/ed"
                 android:background="@drawable/shopcart_add_btn"
                 android:paddingBottom="2dp"
                 android:paddingLeft="20dp"
                 android:paddingRight="20dp"
                 android:paddingTop="2dp"
                 />
             <ImageView
                 android:focusable="false"
                 android:id="@+id/jia"
                 android:layout_width="40px"
                 android:layout_height="40px"
                 android:src="@drawable/shopcart_add_red"/>


         </LinearLayout>
     </LinearLayout>

</LinearLayout>

----------------------show_prent.xml--------------------------

 

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:orientation="vertical"
    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="wrap_content"
       android:orientation="horizontal">
       <CheckBox
           android:focusable="false"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/prent_ck"/>

    <TextView
        android:text="商家 "
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/prent_tv"/>
   </LinearLayout>
</LinearLayout>

-------------------------web_view.xml---------------------------

 

 

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

</LinearLayout>

----------------(->res->anim->end.xml)-----------------------------

 

 

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0%"
    android:toXDelta="-100%"
    android:duration="2000">

</translate>

 

----------------(->res->anim->start.xml)-----------------------------

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2000"
    android:fromXDelta="100%"
    android:toXDelta="0%"
    >

</translate>

 

----------------(->res->drawable->shopcart_add_btn.xml)-----------------------------

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <corners android:radius="200dp"></corners>
    <stroke android:color="@color/colorPrimaryDark" android:width="1dp"></stroke>
</shape>

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

窗台的花花

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值