购物车添加和删除

master
ghtMare 2 years ago
commit 9fc0b45fc7

@ -101,7 +101,7 @@ public class ShoppingCartFragment extends Fragment implements View.OnClickListen
}
private void setData() {
Bundle bundle = getArguments();
usernameText.setText(String.format("用户名:%s", bundle.getString("username")));
// usernameText.setText(String.format("用户名:%s", bundle.getString("username")));
userId=(Integer)bundle.getInt("id");
System.out.println(userId);
}

@ -20,7 +20,7 @@ import okhttp3.Response;
public class OkHttpClientProduct {
public static String Url="http://10.21.91.105:8081";
public static String Url="http://10.21.196.161:8081";
/**
*
*

@ -14,6 +14,7 @@
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<<<<<<< HEAD
<GridView
android:id="@+id/cart_productList"
@ -25,6 +26,16 @@
</LinearLayout>
<include layout="@layout/cart_buttonlayout" />
=======
>>>>>>> 4b47b9061cf2fa7113e15935ab3dee39268832f9
<include
layout="@layout/shop"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<include layout="@layout/cart_buttonlayout" />
</LinearLayout>
</LinearLayout>

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical">
android:orientation="horizontal">
<ImageView
android:id="@+id/category_product_image"
@ -12,26 +12,54 @@
android:layout_gravity="center"
android:layout_marginTop="5dp" />
<TextView
android:id="@+id/category_product_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_toRightOf="@+id/category_product_image"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_marginTop="25dp"
android:textColor="#050505"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/category_product_price"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_toRightOf="@+id/category_product_name"
android:layout_gravity="center"
android:layout_marginLeft="100dp"
android:layout_marginTop="25dp"
android:gravity="center"
android:textColor="#050505"
android:textSize="16sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/category_product_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/category_product_image"
android:textColor="#050505"
android:textSize="16sp" />
<TextView
android:id="@+id/category_product_price"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginLeft="100dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/category_product_name"
android:gravity="center"
android:textColor="#050505"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/addCart"
android:layout_marginTop="10dp"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="220dp"
android:background="@drawable/left" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -18,24 +18,12 @@
android:layout_gravity="center"
android:src="@drawable/arrow_left" />
<TextView
android:id="@+id/username"
android:layout_width="0dp"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="center"
android:text="shopping cart"
android:layout_marginRight="0dp"
android:textColor="#FFF"
android:textSize="20sp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="center"
android:text="shopping cart"
android:layout_marginRight="40dp"
android:text="删除"
android:layout_marginLeft="270dp"
android:textColor="#FFF"
android:textSize="20sp" />
</LinearLayout>

Loading…
Cancel
Save