购物车添加和删除

master
ghtMare 2 years ago
commit 9fc0b45fc7

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

@ -20,7 +20,7 @@ import okhttp3.Response;
public class OkHttpClientProduct { 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_marginTop="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:orientation="vertical"> android:orientation="vertical">
<<<<<<< HEAD
<GridView <GridView
android:id="@+id/cart_productList" android:id="@+id/cart_productList"
@ -25,6 +26,16 @@
</LinearLayout> </LinearLayout>
<include layout="@layout/cart_buttonlayout" /> <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"?> <?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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#fff" android:background="#fff"
android:orientation="vertical"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/category_product_image" android:id="@+id/category_product_image"
@ -12,14 +12,25 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="5dp" /> android:layout_marginTop="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/category_product_name" android:id="@+id/category_product_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_toRightOf="@+id/category_product_image"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="50dp" android:layout_marginLeft="50dp"
android:layout_marginTop="25dp" android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/category_product_image"
android:textColor="#050505" android:textColor="#050505"
android:textSize="16sp" /> android:textSize="16sp" />
@ -27,11 +38,28 @@
android:id="@+id/category_product_price" android:id="@+id/category_product_price"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_toRightOf="@+id/category_product_name"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="100dp" android:layout_marginLeft="100dp"
android:layout_marginTop="25dp" android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/category_product_name"
android:gravity="center" android:gravity="center"
android:textColor="#050505" android:textColor="#050505"
android:textSize="16sp" /> android:textSize="16sp" />
</RelativeLayout> </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:layout_gravity="center"
android:src="@drawable/arrow_left" /> android:src="@drawable/arrow_left" />
<TextView <TextView
android:id="@+id/username" android:layout_width="50dp"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:text="shopping cart" android:text="删除"
android:layout_marginRight="0dp" android:layout_marginLeft="270dp"
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:textColor="#FFF" android:textColor="#FFF"
android:textSize="20sp" /> android:textSize="20sp" />
</LinearLayout> </LinearLayout>

Loading…
Cancel
Save