master
ghtMare 2 years ago
parent 9fc0b45fc7
commit ff95d4c0b2

@ -142,7 +142,7 @@ public class CatProductController {
file.transferTo(destFile);
}
map.put("flag", true);
map.put("data", "http://10.21.91.105:8081/uploaded/" + fileName);
map.put("data", "http://10.21.166.232:8081/uploaded/" + fileName);
return map;
} catch (Exception e) {
map.put("flag", false);

@ -87,7 +87,7 @@ public class CatShoppingCartController {
file.transferTo(destFile);
}
map.put("flag", true);
map.put("data", "http://10.21.91.105:8081/uploaded/" + fileName);
map.put("data", "http://10.21.166.232:8081/uploaded/" + fileName);
return map;
} catch (Exception e) {
map.put("flag", false);
@ -128,7 +128,7 @@ public class CatShoppingCartController {
return map;
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@RequestMapping(value = "/updateS", method = RequestMethod.POST)
public Map<String, Object> updateProduct(@RequestBody CatShoppingCart catProduct) {
Integer updateFlag = shoppingCartService.updateShoppingCart(catProduct);
Map<String, Object> map = new HashMap<>();
@ -142,4 +142,18 @@ public class CatShoppingCartController {
return map;
}
@RequestMapping(value = "/searchBypId", method = RequestMethod.POST)
public Map<String, Object> searchProductById(@Param("userId") String userId,@Param("productId") String productId) {
CatShoppingCart catProduct = shoppingCartService.selectByproductId(Integer.valueOf(userId),Integer.valueOf(productId));
Map<String, Object> map = new HashMap<>();
if (Objects.isNull(catProduct)) {
map.put("flag", false);
map.put("msg", "search by id error");
return map;
}
map.put("flag", true);
map.put("data", catProduct);
return map;
}
}

@ -44,5 +44,6 @@ public interface ShoppingCartMapper {
Integer addShop(@Param("userId")Integer userId,@Param("productId")Integer productId);
Integer updateShoppingCart(CatShoppingCart catShoppingCart);
CatShoppingCart selectByproductId(@Param("userId")Integer userId,@Param("productId")Integer productId);
}

@ -58,5 +58,10 @@ public class ShoppingCartService {
public Integer updateShoppingCart(CatShoppingCart catShoppingCart){
return shoppingCartMapper.updateShoppingCart(catShoppingCart);
}
public CatShoppingCart selectByproductId(Integer userId,Integer productId) {
return shoppingCartMapper.selectByproductId(userId,productId);
}
}

@ -8,9 +8,12 @@
<select id="selectShoppingCart" resultType="com.example.cat.entity.CatShoppingCart">
select id,user_id,product_id,num from orange_shoppingcart where user_id=#{userId}
</select>
<select id="selectByproductId" resultType="com.example.cat.entity.CatShoppingCart">
select id,user_id,product_id,num from orange_product where user_id=#{userId} and product_id =#{productId}
</select>
<update id="updateShoppingCart" parameterType="com.example.cat.entity.CatShoppingCart">
update orange_shoppingcart set num=#{num}
where product_id=#{productId} and user_id=userId
update orange_shoppingcart set num=#{num}+1
where product_id=#{productId} and user_id=#{userId}
</update>
<delete id="deleteShoppingCart">
@ -18,7 +21,7 @@
</delete>
<delete id="deleteShop">
delete from orange_shoppingcart where product_id=#{productId} and user_id=#{userId} ;
delete from orange_shoppingcart where user_id=#{userId} and (product_id=#{productId} or num=0) ;
</delete>
<insert id="addShoppingCart" >
@ -29,4 +32,5 @@
insert into orange_shoppingcart(user_id,product_id,num) values (#{userId},#{productId},1)
</insert>
</mapper>

@ -4,10 +4,13 @@ import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.catapp.R;
@ -32,6 +35,8 @@ public class IndexActivity extends Activity implements View.OnClickListener {
private LinearLayout indexLine, productLine, shoppingCartLine, pearsonLine;
public static List<ShoppingCartPack> cartList = new ArrayList<>();
private Integer userId=1;
public static int flag=0;
Handler h;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -40,8 +45,7 @@ public class IndexActivity extends Activity implements View.OnClickListener {
initIndexFragment();
Thread thread = new Thread(runnable);
thread.start();
check();//检查用户购物车是否为空
Log.d("InActivity get cartList.size() ",""+cartList.size());
check();
}
/**
@ -61,6 +65,7 @@ public class IndexActivity extends Activity implements View.OnClickListener {
@Override
public void onClick(View v) {
check();//检查用户购物车是否为空
switch (v.getId()) {
case R.id.content_index:
initIndexFragment();
@ -70,6 +75,7 @@ public class IndexActivity extends Activity implements View.OnClickListener {
break;
case R.id.content_cart:
initshoppingCartFragment();
flag=1;
break;
case R.id.content_pearson:
initpearsonFragment();
@ -84,7 +90,7 @@ public class IndexActivity extends Activity implements View.OnClickListener {
Intent intent = IndexActivity.this.getIntent();
Bundle bundle = intent.getExtras();
userId=(Integer)bundle.getInt("id");
Log.d("IndexActivity.userId",""+userId);
//Log.d("IndexActivity.userId",""+userId);
}
/**
* Fragment
@ -119,6 +125,7 @@ public class IndexActivity extends Activity implements View.OnClickListener {
* Fragment
*/
private void initshoppingCartFragment() {
check();//检查用户购物车是否为空
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (shoppingCartFragment == null) {
@ -156,17 +163,30 @@ public class IndexActivity extends Activity implements View.OnClickListener {
*
*/
public void check(){
h=new Handler(){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
}
};
new Thread(new Runnable() {
@Override
public void run() {
OkHttpShoppingcart okHttpShoppingcart=new OkHttpShoppingcart();
try {
if(okHttpShoppingcart.getShoppingCartPack(userId)==null)return;
if(okHttpShoppingcart.getShoppingCartPack(userId)==null)
{
cartList=null;
return;
}
cartList=okHttpShoppingcart.getShoppingCartPack(userId);
Log.d("check()",""+(cartList.size()));
Log.d("IndexActivity______check()",""+(cartList.size()));
} catch (IOException e) {
throw new RuntimeException(e);
}
Message message=new Message();
h.sendMessage(message);
}
}).start();
}

@ -5,14 +5,20 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.catapp.R;
import com.example.catapp.activity.IndexActivity;
import com.example.catapp.entity.CatProductPack;
import com.example.catapp.entity.ShoppingCart;
import com.example.catapp.entity.ShoppingCartPack;
import com.example.catapp.fragment.ShoppingCartFragment;
import com.example.catapp.netrequest.OkHttpShoppingcart;
import java.io.IOException;
import java.util.List;
public class ShoppingCartAdapter extends BaseAdapter {
@ -20,15 +26,22 @@ public class ShoppingCartAdapter extends BaseAdapter {
private List<CatProductPack> catProductList;
private LayoutInflater layoutInflater;
public ShoppingCartAdapter(Context context, List<CatProductPack> catProductList,List<ShoppingCartPack> shoppingCartList) {
public int flag=0;
private int listNum=0;
int user;
public boolean isSelect=false;
public ShoppingCartAdapter(Context context, List<CatProductPack> catProductList,List<ShoppingCartPack> shoppingCartList,int user) {
this.catProductList = catProductList;
this.shoppingCartList=shoppingCartList;
this.layoutInflater = LayoutInflater.from(context);
this.user=user;
}
public int getCount() {
return catProductList.size();
listNum=0;
if (catProductList!=null)listNum=catProductList.size();
return listNum;
}
public Object getItem(int position) {
@ -47,7 +60,11 @@ public class ShoppingCartAdapter extends BaseAdapter {
viewHolder.productImage = convertView.findViewById(R.id.category_product_image);
viewHolder.productName = convertView.findViewById(R.id.category_product_name);
viewHolder.productPrice = convertView.findViewById(R.id.category_product_price);
viewHolder.left=convertView.findViewById(R.id.left);
viewHolder.right=convertView.findViewById(R.id.right);
viewHolder.num = convertView.findViewById(R.id.num);
viewHolder.delete=convertView.findViewById(R.id.delete);
viewHolder.checkBox=convertView.findViewById(R.id.checkbox);
convertView.setTag(viewHolder);
} else {
viewHolder = (ShoppingCartAdapter.ViewHolder) convertView.getTag();
@ -61,14 +78,90 @@ public class ShoppingCartAdapter extends BaseAdapter {
ShoppingCartPack shoppingCart=shoppingCartList.get(position);
if(shoppingCart!=null)
viewHolder.num.setText(""+shoppingCart.getNum());
/*
*/
viewHolder.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
OkHttpShoppingcart okHttpShoppingcart = new OkHttpShoppingcart();
try {
okHttpShoppingcart.deleteShoppingCart(user, catProductList.get(position).getId());
} catch (IOException e) {
throw new RuntimeException(e);
}
notifyDataSetChanged();
try {
IndexActivity.cartList=okHttpShoppingcart.getShoppingCartPack(user);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}).start();
Toast.makeText(v.getContext(), "delete"+" ", Toast.LENGTH_SHORT).show();
}
});
viewHolder.left.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
OkHttpShoppingcart okHttpShoppingcart = new OkHttpShoppingcart();
try {
okHttpShoppingcart.deleteShoppingCart(user, catProductList.get(position).getId());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}).start();
Toast.makeText(v.getContext(), "delete", Toast.LENGTH_SHORT).show();
}
});
// viewHolder.checkBox.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// if(viewHolder.checkBox.isChecked()){
// new Thread(new Runnable() {
// @Override
// public void run() {
// OkHttpShoppingcart okHttpShoppingcart = new OkHttpShoppingcart();
// try {
// okHttpShoppingcart.deleteShoppingCart(user, catProductList.get(position).getId());
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }
// }).start();
// }
// }
// });
return convertView;
}
@Override
public void notifyDataSetChanged() {
super.notifyDataSetChanged();
}
class ViewHolder {
ImageView productImage;
TextView productName, productPrice,num;
ImageView left,right;
ImageView left,right,delete;
CheckBox checkBox;
}
}

@ -105,20 +105,6 @@ public class ProductFragment extends Fragment {
productGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// FragmentTransaction transaction = getFragmentManager().beginTransaction();
// if (productDetailFragment == null) {
// bundle = getArguments();
// int i=bundle.getInt("id");
// bundle.putInt("userId",i);
// bundle.putInt("productId",catProductList.get(position).getId());
// bundle.putString("name",catProductList.get(position).getName());
// bundle.putString("price",catProductList.get(position).getPrice().toString());
// bundle.putParcelable("imgBitmap",catProductList.get(position).getImgBitmap());
// productDetailFragment = new ProductDetailFragment();
// productDetailFragment.setArguments(bundle);
// }
// transaction.replace(R.id.main_content0,productDetailFragment);
// transaction.commit();
bundle = getArguments();
int i=bundle.getInt("id");
int p =catProductList.get(position).getId();

@ -47,32 +47,28 @@ public class ShoppingCartFragment extends Fragment implements View.OnClickListen
private ProductFragment productFragment;
private GridView productGridView;
private TextView usernameText;
ImageView left_l,right_r;
ImageView left_l,right_r,delete;
private RecyclerView recyclerView;
CheckBox checkBox;
int listNum=0;
private Integer userId=13;
private List<CatProductPack> catProductList= new ArrayList<>();
Handler h=null;
public ShopAdapter shopAdapter=null;
static int o;
private boolean isGetData = false;
CheckBox checkBox;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//给购物车集合赋值,用以判断界面的展示
cartList=IndexActivity.cartList;
Log.d("ShoppingCartFragment onCrate init cartList",""+cartList);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view;
cartList=IndexActivity.cartList;
Log.d("cartList---------",""+cartList.size());
if (cartList.size() > 0) {
if(IndexActivity.cartList!=null)
listNum=IndexActivity.cartList.size();
if (listNum > 0) {
//有商品
view = LayoutInflater.from(getActivity()).inflate(R.layout.cart_have_product, container, false);
linkHttp(view);
@ -88,10 +84,10 @@ public class ShoppingCartFragment extends Fragment implements View.OnClickListen
*/
private void init(View view) {
usernameText=view.findViewById(R.id.username);
checkBox=view.findViewById(R.id.checkbox);
productGridView = view.findViewById(R.id.cart_productList);
if (cartList.size() > 0) {
if (listNum > 0) {
productGridView = view.findViewById(R.id.cart_productList);
checkBox=view.findViewById(R.id.checkbox);
delete=view.findViewById(R.id.delete);
}
else {
walkButton = view.findViewById(R.id.random_search);
@ -101,32 +97,31 @@ 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);
}
// @Override
// public void onClick(View v) {
// if (cartList.size() > 0) {
//
// }
// else {
// switch (v.getId()) {
// case R.id.random_search:
// //开启事务fragment的控制是由事务来实现的
// FragmentTransaction transaction = getFragmentManager().beginTransaction();
// if (productFragment == null) {
// Bundle bundle = getArguments();
// productFragment.setArguments(bundle);
// productFragment = new ProductFragment();
// bundle.putInt("id",userId);
// }
// transaction.replace(R.id.main_content0, productFragment);
// transaction.commit();
// break;
// }
// }
// }
@Override
public void onClick(View v) {
if (listNum > 0) {
}
else {
switch (v.getId()) {
case R.id.random_search:
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (productFragment == null) {
productFragment = new ProductFragment();
Bundle bundle = getArguments();
productFragment.setArguments(bundle);
bundle.putInt("id",userId);
}
transaction.replace(R.id.main_content0, productFragment);
transaction.commit();
break;
}
}
}
/**
@ -143,34 +138,8 @@ public class ShoppingCartFragment extends Fragment implements View.OnClickListen
// recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
// shopAdapter=new ShopAdapter(getActivity(),catProductList,cartList);
// recyclerView.setAdapter(shopAdapter);
ShoppingCartAdapter shoppingCartAdapter=new ShoppingCartAdapter(getActivity(),catProductList,cartList);
ShoppingCartAdapter shoppingCartAdapter=new ShoppingCartAdapter(getActivity(),catProductList,cartList,userId);
productGridView.setAdapter(shoppingCartAdapter);
productGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Bundle bundle = getArguments();
//usernameText.setText(String.format("用户名:%s", bundle.getString("username")));
int i=(Integer)bundle.getInt("id");
int p=cartList.get(position).getId();
System.out.println(""+1111111+"----"+p+"---"+i);
new Thread(new Runnable() {
@SuppressLint("HandlerLeak")
@Override
public void run() {
OkHttpShoppingcart okHttpShoppingcart=new OkHttpShoppingcart();
try {
okHttpShoppingcart.deleteShoppingCart(i,p);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}).start();
Toast.makeText(getContext(), "delete", Toast.LENGTH_SHORT).show();
}
});
}
};
@ -179,12 +148,12 @@ public class ShoppingCartFragment extends Fragment implements View.OnClickListen
public void run() {
OkHttpShoppingcart okHttpShoppingcart=new OkHttpShoppingcart();
try {
// recyclerView=view.findViewById(R.id.recyclerview);
productGridView = view.findViewById(R.id.cart_productList);
left_l=view.findViewById(R.id.left);
right_r=view.findViewById(R.id.right);
catProductList= okHttpShoppingcart.getProductPack(userId);
cartList=okHttpShoppingcart.getShoppingCartPack(userId);
IndexActivity.cartList=cartList;
} catch (IOException e) {
throw new RuntimeException(e);
}
@ -194,9 +163,21 @@ public class ShoppingCartFragment extends Fragment implements View.OnClickListen
}).start();
}
@Override
public void onClick(View v) {
public void onDestroyView() {
super.onDestroyView();
//Log.d("Destroy","--------Destroy shoppingcart fragment");
}
public void refreshData(){
ShoppingCartFragment shoppingCartFragment=new ShoppingCartFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (shoppingCartFragment == null) {
shoppingCartFragment = new ShoppingCartFragment();
}
Bundle bundle = getArguments();
shoppingCartFragment.setArguments(bundle);
bundle.putInt("id",userId);
transaction.replace(R.id.main_content0, shoppingCartFragment);
transaction.commit();
}
}

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

@ -45,9 +45,6 @@ public class OkHttpShoppingcart {
.post(requestBody)
.build();
Response response = okHttpClient.newCall(request).execute();
System.out.println(response.isSuccessful());
System.out.println(response.isSuccessful());
System.out.println(response.isSuccessful());
JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(response.body()).string());
List<CatProduct> list = JSON.parseObject(jsonObject.getString("data"), new TypeReference<List<CatProduct>>() {
});
@ -114,7 +111,6 @@ public class OkHttpShoppingcart {
*/
public List<ShoppingCart> getShoppingCart(Integer userId) throws IOException {
OkHttpClient okHttpClient = new OkHttpClient();
//数据类型为json格式
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
//将对象转为JSON字符串
@ -125,12 +121,10 @@ public class OkHttpShoppingcart {
.post(requestBody)
.build();
Response response = okHttpClient.newCall(request).execute();
Log.d("getShoppingCart request is :",""+response.isSuccessful());
String responseStr = response.body().string();
JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(responseStr));
List<ShoppingCart> list = JSON.parseObject(jsonObject.getString("data"), new TypeReference<List<ShoppingCart>>() {
});
Log.d("list",""+(list!=null));
return list;
}
@ -172,12 +166,6 @@ public class OkHttpShoppingcart {
catProductPack.setImgBitmap(getImageBitMap(catProduct.getImgUrl()));
catProductPack.setAddTime(catProduct.getAddTime());
catProductPack.setPrice(catProduct.getPrice());
System.out.println(catProduct.getPrice());
System.out.println(catProduct.getPrice());
System.out.println(catProduct.getPrice());
System.out.println(catProduct.getPrice());
System.out.println(catProduct.getPrice());
System.out.println(catProduct.getPrice());
packList.add(catProductPack);
}
return packList;
@ -201,7 +189,6 @@ public class OkHttpShoppingcart {
catProductPack.setProductId(catProduct.getProductId());
catProductPack.setNum(catProduct.getNum());
packList.add(catProductPack);
System.out.println(6666666);
}
return packList;}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

@ -14,7 +14,6 @@
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<<<<<<< HEAD
<GridView
android:id="@+id/cart_productList"
@ -26,16 +25,6 @@
</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"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="horizontal">
android:orientation="vertical">
<ImageView
android:id="@+id/category_product_image"
@ -12,54 +12,26 @@
android:layout_gravity="center"
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
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>
<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>
<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>

@ -12,6 +12,7 @@
android:orientation="horizontal">
<CheckBox
android:focusable="false"
android:id="@+id/checkbox"
android:layout_width="46dp"
android:layout_height="match_parent"
@ -19,13 +20,13 @@
<ImageView
android:id="@+id/category_product_image"
android:layout_width="111dp"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_weight="6"
android:background="#1EFFFFFF"
@ -58,9 +59,9 @@
<TextView
android:id="@+id/num"
android:layout_width="18dp"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="20dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="50dp"
android:layout_toRightOf="@+id/left"
android:background="#00FEFEFE"
@ -73,11 +74,19 @@
android:layout_width="42dp"
android:layout_height="44dp"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginTop="50dp"
android:layout_toRightOf="@id/num"
android:background="@drawable/right" />
<ImageView
android:id="@+id/delete"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:src="@drawable/delete"
android:layout_marginRight="5dp"/>
</LinearLayout>
</LinearLayout>

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

Loading…
Cancel
Save