activity_main.xml:
<LinearLayout
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#E24146"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="48dp"
android:text="购物车"
android:textColor="#ffffff"
android:textSize="17sp" />
</LinearLayout>
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:childIndicator="@null"
android:groupIndicator="@null"></ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:gravity="center_vertical"
android:orientation="horizontal">
<CheckBox
android:id="@+id/all_chekbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="4dp"
android:button="@drawable/check_box_bg"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center"
android:minHeight="64dp"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="合计:"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_total_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥0.00"
android:textColor="@color/purple"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/tv_delete"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/orange"
android:clickable="true"
android:gravity="center"
android:text="删除"
android:textColor="#FAFAFA" />
<TextView
android:id="@+id/tv_go_to_pay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#E24146"
android:clickable="true"
android:gravity="center"
android:text="付款(0)"
android:textColor="#FAFAFA" />
</LinearLayout>
主界面MainActivity:
public class MainActivity extends AppCompatActivity implements CartAdapter.RefreshPriceInterface, View.OnClickListener {
private ListView listView;
private CheckBox cb_check_all;
private TextView tv_total_price;
private TextView tv_delete;
private TextView tv_go_to_pay;
private CartAdapter adapter;
private double totalPrice = 0.00;
private int totalCount = 0;
private List<HashMap<String, String>> goodsList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initDate();
}
//控制价格展示
private void priceControl(Map<String, Integer> pitchOnMap) {
totalCount = 0;
totalPrice = 0.00;
for (int i = 0; i < goodsList.size(); i++) {
if (pitchOnMap.get(goodsList.get(i).get("id")) == 1) {
totalCount = totalCount + Integer.valueOf(goodsList.get(i).get("count"));
double goodsPrice = Integer.valueOf(goodsList.get(i).get("count")) * Double.valueOf(goodsList.get(i).get("price"));
totalPrice = totalPrice + goodsPrice;
}
}
tv_total_price.setText("¥ " + totalPrice);
tv_go_to_pay.setText("付款(" + totalCount + ")");
}
@Override
public void refreshPrice(Map<String, Integer> pitchOnMap) {
priceControl(pitchOnMap);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.all_chekbox:
AllTheSelected();
break;
case R.id.tv_go_to_pay:
if (totalCount <= 0) {
Toast.makeText(this, "请选择要付款的商品~", Toast.LENGTH_SHORT).show();
return;
}
Toast.makeText(this, "钱就是另一回事了~", Toast.LENGTH_SHORT).show();
break;
case R.id.tv_delete:
if (totalCount <= 0) {
Toast.makeText(this, "请选择要删除的商品~", Toast.LENGTH_SHORT).show();
return;
}
checkDelete(adapter.getPitchOnMap());
break;
}
}
//删除操作
private void checkDelete(Map<String, Integer> map) {
List<HashMap<String, String>> waitDeleteList = new ArrayList<>();
Map<String, Integer> waitDeleteMap = new HashMap<>();
for (int i = 0; i < goodsList.size(); i++) {
if (map.get(goodsList.get(i).get("id")) == 1) {
waitDeleteList.add(goodsList.get(i));
waitDeleteMap.put(goodsList.get(i).get("id"), map.get(goodsList.get(i).get("id")));
}
}
goodsList.removeAll(waitDeleteList);
map.remove(waitDeleteMap);
priceControl(map);
adapter.notifyDataSetChanged();
}
//全选或反选
private void AllTheSelected() {
Map<String, Integer> map = adapter.getPitchOnMap();
boolean isCheck = false;
boolean isUnCheck = false;
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
if (Integer.valueOf(entry.getValue().toString()) == 1) isCheck = true;
else isUnCheck = true;
}
if (isCheck == true && isUnCheck == false) {//已经全选,做反选
for (int i = 0; i < goodsList.size(); i++) {
map.put(goodsList.get(i).get("id"), 0);
}
cb_check_all.setChecked(false);
} else if (isCheck == true && isUnCheck == true) {//部分选择,做全选
for (int i = 0; i < goodsList.size(); i++) {
map.put(goodsList.get(i).get("id"), 1);
}
cb_check_all.setChecked(true);
} else if (isCheck == false && isUnCheck == true) {//一个没选,做全选
for (int i = 0; i < goodsList.size(); i++) {
map.put(goodsList.get(i).get("id"), 1);
}
cb_check_all.setChecked(true);
}
priceControl(map);
adapter.setPitchOnMap(map);
adapter.notifyDataSetChanged();
}
private void initView() {
listView = (ListView) findViewById(R.id.listview);
cb_check_all = (CheckBox) findViewById(R.id.all_chekbox);
tv_total_price = (TextView) findViewById(R.id.tv_total_price);
tv_delete = (TextView) findViewById(R.id.tv_delete);
tv_go_to_pay = (TextView) findViewById(R.id.tv_go_to_pay);
tv_go_to_pay.setOnClickListener(this);
tv_delete.setOnClickListener(this);
cb_check_all.setOnClickListener(this);
adapter = new CartAdapter(this, goodsList);
adapter.setRefreshPriceInterface(this);
listView.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
private void initDate() {
goodsList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
HashMap<String, String> map = new HashMap<>();
map.put("id", (new Random().nextInt(10000) % (10000 - 2900 + 2900) + 2900) + "");
map.put("name", "购物车里的第" + (i + 1) + "件商品");
map.put("type", (i + 20) + "码");
map.put("price", (new Random().nextInt(100) % (100 - 29 + 29) + 29) + "");
map.put("count", (new Random().nextInt(10) % (10 - 1 + 1) + 1) + "");
goodsList.add(map);
}
initView();
}
}
cart.xml:
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#CCCCCC" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/page_backgroup"
android:orientation="horizontal">
<CheckBox
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="4dp"
android:button="@drawable/check_box_bg"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center"
android:minHeight="64dp"
android:minWidth="32dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="visible" />
<ImageView
android:id="@+id/iv_adapter_list_pic"
android:layout_width="85dp"
android:layout_height="85dp"
android:layout_marginBottom="15dp"
android:layout_marginTop="13dp"
android:scaleType="centerCrop"
android:src="@mipmap/good_icon" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="13dp"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/tv_goods_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/grey_color1"
android:textSize="14sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="@color/orange_color"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_type_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/tv_goods_price"
android:singleLine="true"
android:textColor="@color/grey_color3"
android:textSize="10sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_reduce"
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/text_angle_gray"
android:gravity="center"
android:text="一"
android:textColor="@color/grey_color1"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_num"
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/text_angle"
android:gravity="center"
android:singleLine="true"
android:text="1"
android:textColor="@color/grey_color1"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_add"
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/text_angle_right"
android:gravity="center"
android:text="+"
android:textColor="@color/grey_color1"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
CartAdapter:
class CartAdapter extends BaseAdapter {
private Context context;
private List<HashMap<String, String>> dataList;
private ViewHolder vh;
private Map<String, Integer> pitchOnMap;
private RefreshPriceInterface refreshPriceInterface;
public CartAdapter(Context context, List<HashMap<String, String>> list) {
this.context = context;
this.dataList = list;
pitchOnMap = new HashMap<>();
for (int i = 0; i < dataList.size(); i++) {
pitchOnMap.put(dataList.get(i).get("id"), 0);
}
}
@Override
public View getView(final int position, View view, ViewGroup viewGroup) {
vh = new ViewHolder();
if (view == null) {
view = LayoutInflater.from(context).inflate(R.layout.item_shopcart_product, null);
vh.checkBox = (CheckBox) view.findViewById(R.id.check_box);
vh.icon = (ImageView) view.findViewById(R.id.iv_adapter_list_pic);
vh.name = (TextView) view.findViewById(R.id.tv_goods_name);
vh.price = (TextView) view.findViewById(R.id.tv_goods_price);
vh.type = (TextView) view.findViewById(R.id.tv_type_size);
vh.num = (TextView) view.findViewById(R.id.tv_num);
vh.reduce = (TextView) view.findViewById(R.id.tv_reduce);
vh.add = (TextView) view.findViewById(R.id.tv_add);
view.setTag(vh);
} else {
vh = (ViewHolder) view.getTag();
}
if (dataList.size() > 0) {
if (pitchOnMap.get(dataList.get(position).get("id")) == 0)
vh.checkBox.setChecked(false);
else vh.checkBox.setChecked(true);
HashMap<String, String> map = dataList.get(position);
vh.name.setText(map.get("name"));
vh.num.setText(map.get("count"));
vh.type.setText(map.get("type"));
vh.price.setText("¥ " + (Double.valueOf(map.get("price")) * Integer.valueOf(map.get("count"))));
vh.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final int index = position;
if (((CheckBox) view).isChecked())
pitchOnMap.put(dataList.get(index).get("id"), 1);
else pitchOnMap.put(dataList.get(index).get("id"), 0);
refreshPriceInterface.refreshPrice(pitchOnMap);
}
});
vh.reduce.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final int index = position;
dataList.get(index).put("count", (Integer.valueOf(dataList.get(index).get("count")) - 1) + "");
if (Integer.valueOf(dataList.get(index).get("count")) <= 0) {
//可提示是否删除该商品,确定就remove,否则就保留1
String deID = dataList.get(index).get("id");
dataList.remove(index);
pitchOnMap.remove(deID);
}
notifyDataSetChanged();
refreshPriceInterface.refreshPrice(pitchOnMap);
}
});
vh.add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final int index = position;
dataList.get(index).put("count", (Integer.valueOf(dataList.get(index).get("count")) + 1) + "");
if (Integer.valueOf(dataList.get(index).get("count")) > 15) {
//15为库存可选择上限
Toast.makeText(context, "已达库存上限~", Toast.LENGTH_SHORT).show();
return;
}
notifyDataSetChanged();
refreshPriceInterface.refreshPrice(pitchOnMap);
}
});
}
return view;
}
public Map<String, Integer> getPitchOnMap() {
return pitchOnMap;
}
public void setPitchOnMap(Map<String, Integer> pitchOnMap) {
this.pitchOnMap = new HashMap<>();
this.pitchOnMap.putAll(pitchOnMap);
}
public interface RefreshPriceInterface {
void refreshPrice(Map<String, Integer> pitchOnMap);
}
public void setRefreshPriceInterface(RefreshPriceInterface refreshPriceInterface) {
this.refreshPriceInterface = refreshPriceInterface;
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;img_check_no.png
img_check_yes.png
} @Override public int getCount() { if (dataList != null) { return dataList.size(); } else { return 0; } } class ViewHolder { CheckBox checkBox; ImageView icon; TextView name, price, num, type, reduce, add; }}
values文件夹下的colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="list_divider">#999999</color>
<color name="list_item_pressed">#D7D7D7</color>
<color name="white">#ffffff</color>
<color name="ivory">#fffff0</color>
<color name="lightyellow">#ffffe0</color>
<color name="capture_text_cover_bg">#3060a4e3</color>
<color name="yellow">#ffff00</color>
<color name="snow">#fffafa</color>
<color name="floralwhite">#fffaf0</color>
<color name="lemonchiffon">#fffacd</color>
<color name="cornsilk">#fff8dc</color>
<color name="seaShell">#fff5ee</color>
<color name="lavenderblush">#fff0f5</color>
<color name="papayawhip">#ffefd5</color>
<color name="blanchedalmond">#ffebcd</color>
<color name="mistyrose">#ffe4e1</color>
<color name="bisque">#ffe4c4</color>
<color name="moccasin">#ffe4b5</color>
<color name="navajowhite">#ffdead</color>
<color name="peachpuff">#ffdab9</color>
<color name="gold">#ffd700</color>
<color name="pink">#ffc0cb</color>
<color name="lightpink">#ffb6c1</color>
<color name="orange">#fd7903</color>
<color name="lightsalmon">#ffa07a</color>
<color name="darkorange">#ff8c00</color>
<color name="coral">#ff7f50</color>
<color name="hotpink">#ff69b4</color>
<color name="tomato">#ff6347</color>
<color name="orangered">#ff4500</color>
<color name="deeppink">#ff1493</color>
<color name="fuchsia">#ff00ff</color>
<color name="magenta">#ff00ff</color>
<color name="red">#ff0000</color>
<color name="oldlace">#fdf5e6</color>
<color name="lightgoldenrodyellow">#fafad2</color>
<color name="linen">#faf0e6</color>
<color name="antiquewhite">#faebd7</color>
<color name="salmon">#fa8072</color>
<color name="ghostwhite">#f8f8ff</color>
<color name="mintcream">#f5fffa</color>
<color name="whitesmoke">#f5f5f5</color>
<color name="beige">#f5f5dc</color>
<color name="wheat">#f5deb3</color>
<color name="sandybrown">#f4a460</color>
<color name="azure">#f0ffff</color>
<color name="honeydew">#f0fff0</color>
<color name="aliceblue">#f0f8ff</color>
<color name="khaki">#f0e68c</color>
<color name="lightcoral">#f08080</color>
<color name="palegoldenrod">#eee8aa</color>
<color name="violet">#ee82ee</color>
<color name="darksalmon">#e9967a</color>
<color name="lavender">#e6e6fa</color>
<color name="lightcyan">#e0ffff</color>
<color name="burlywood">#deb887</color>
<color name="plum">#dda0dd</color>
<color name="gainsboro">#dcdcdc</color>
<color name="crimson">#dc143c</color>
<color name="palevioletred">#db7093</color>
<color name="goldenrod">#daa520</color>
<color name="orchid">#da70d6</color>
<color name="thistle">#d8bfd8</color>
<color name="lightgray">#d3d3d3</color>
<color name="lightgrey">#d3d3d3</color>
<color name="tan">#d2b48c</color>
<!-- 茶色 -->
<color name="chocolate">#d2691e</color>
<!-- 巧可力色 -->
<color name="peru">#cd853f</color>
<!-- 秘鲁色 -->
<color name="indianred">#cd5c5c</color>
<!-- 印第安红 -->
<color name="mediumvioletred">#c71585</color>
<!-- 中紫罗兰色 -->
<color name="silver">#c0c0c0</color>
<!-- 银色 -->
<color name="darkkhaki">#bdb76b</color>
<!-- 暗黄褐色 -->
<color name="rosybrown">#bc8f8f</color>
<!-- 褐玫瑰红 -->
<color name="mediumorchid">#ba55d3</color>
<!-- 中粉紫色 -->
<color name="darkgoldenrod">#b8860b</color>
<!-- 暗金黄色 -->
<color name="firebrick">#b22222</color>
<!-- 火砖色 -->
<color name="powderblue">#b0e0e6</color>
<!-- 粉蓝色 -->
<color name="lightsteelblue">#b0c4de</color>
<!-- 亮钢兰色 -->
<color name="paleturquoise">#afeeee</color>
<!-- 苍宝石绿 -->
<color name="greenyellow">#adff2f</color>
<!-- 黄绿色 -->
<color name="lightblue">#add8e6</color>
<!-- 亮蓝色 -->
<color name="darkgray">#a9a9a9</color>
<!-- 暗灰色 -->
<color name="darkgrey">#a9a9a9</color>
<!-- 暗灰色 -->
<color name="brown">#a52a2a</color>
<!-- 褐色 -->
<color name="sienna">#a0522d</color>
<!-- 赭色 -->
<color name="darkorchid">#9932cc</color>
<!-- 暗紫色 -->
<color name="palegreen">#98fb98</color>
<!-- 苍绿色 -->
<color name="darkviolet">#9400d3</color>
<!-- 暗紫罗兰色 -->
<color name="mediumpurple">#9370db</color>
<!-- 中紫色 -->
<color name="lightgreen">#90ee90</color>
<!-- 亮绿色 -->
<color name="darkseagreen">#8fbc8f</color>
<!-- 暗海兰色 -->
<color name="saddlebrown">#8b4513</color>
<!-- 重褐色 -->
<color name="darkmagenta">#8b008b</color>
<!-- 暗洋红 -->
<color name="darkred">#8b0000</color>
<!-- 暗红色 -->
<color name="blueviolet">#8a2be2</color>
<!-- 紫罗兰蓝色 -->
<color name="lightskyblue">#87cefa</color>
<!-- 亮天蓝色 -->
<color name="skyblue">#87ceeb</color>
<!-- 天蓝色 -->
<color name="gray">#808080</color>
<!-- 灰色 -->
<color name="grey">#7c7b7b</color>
<!-- 灰色 -->
<color name="olive">#808000</color>
<!-- 橄榄色 -->
<color name="purple">#800080</color>
<!-- 紫色 -->
<color name="maroon">#800000</color>
<!-- 粟色 -->
<color name="aquamarine">#7fffd4</color>
<!-- 碧绿色 -->
<color name="chartreuse">#7fff00</color>
<!-- 黄绿色 -->
<color name="lawngreen">#7cfc00</color>
<!-- 草绿色 -->
<color name="mediumslateblue">#7b68ee</color>
<!-- 中暗蓝色 -->
<color name="lightslategray">#778899</color>
<!-- 亮蓝灰 -->
<color name="lightslategrey">#778899</color>
<!-- 亮蓝灰 -->
<color name="slategray">#708090</color>
<!-- 灰石色 -->
<color name="slategrey">#708090</color>
<!-- 灰石色 -->
<color name="olivedrab">#6b8e23</color>
<!-- 深绿褐色 -->
<color name="slateblue">#6a5acd</color>
<!-- 石蓝色 -->
<color name="dimgray">#696969</color>
<!-- 暗灰色 -->
<color name="dimgrey">#696969</color>
<!-- 暗灰色 -->
<color name="mediumaquamarine">#66cdaa</color>
<!-- 中绿色 -->
<color name="cornflowerblue">#6495ed</color>
<!-- 菊兰色 -->
<color name="cadetblue">#5f9ea0</color>
<!-- 军兰色 -->
<color name="darkolivegreen">#556b2f</color>
<!-- 暗橄榄绿 -->
<color name="indigo">#4b0082</color>
<!-- 靛青色 -->
<color name="mediumturquoise">#48d1cc</color>
<!-- 中绿宝石 -->
<color name="darkslateblue">#483d8b</color>
<!-- 暗灰蓝色 -->
<color name="steelblue">#4682b4</color>
<!-- 钢兰色 -->
<color name="royalblue">#4169e1</color>
<!-- 皇家蓝 -->
<color name="turquoise">#40e0d0</color>
<!-- 青绿色 -->
<color name="mediumseagreen">#3cb371</color>
<!-- 中海蓝 -->
<color name="limegreen">#32cd32</color>
<!-- 橙绿色 -->
<color name="darkslategray">#2f4f4f</color>
<!-- 暗瓦灰色 -->
<color name="darkslategrey">#2f4f4f</color>
<!-- 暗瓦灰色 -->
<color name="seagreen">#2e8b57</color>
<!-- 海绿色 -->
<color name="forestgreen">#228b22</color>
<!-- 森林绿 -->
<color name="lightseagreen">#20b2aa</color>
<!-- 亮海蓝色 -->
<color name="dodgerblue">#1e90ff</color>
<!-- 闪兰色 -->
<color name="midnightblue">#191970</color>
<!-- 中灰兰色 -->
<color name="aqua">#00ffff</color>
<!-- 浅绿色 -->
<color name="cyan">#00ffff</color>
<!-- 青色 -->
<color name="springgreen">#00ff7f</color>
<!-- 春绿色 -->
<color name="lime">#00ff00</color>
<!-- 酸橙色 -->
<color name="mediumspringgreen">#00fa9a</color>
<!-- 中春绿色 -->
<color name="darkturquoise">#00ced1</color>
<!-- 暗宝石绿 -->
<color name="deepskyblue">#00bfff</color>
<!-- 深天蓝色 -->
<color name="darkcyan">#008b8b</color>
<!-- 暗青色 -->
<color name="teal">#008080</color>
<!-- 水鸭色 -->
<color name="green">#008000</color>
<!-- 绿色 -->
<color name="darkgreen">#006400</color>
<!-- 暗绿色 -->
<color name="blue">#005dc1</color>
<!-- 蓝色 -->
<color name="mediumblue">#0000cd</color>
<!-- 中兰色 -->
<color name="darkblue">#00008b</color>
<!-- 暗蓝色 -->
<color name="navy">#000080</color>
<!-- 海军色 -->
<color name="black">#3B3B3B</color>
<!-- 黑色 -->
<!-- #2b4f6d 退改签 、选择配送信息中地址 文字的颜色值 -->
<!-- 通用颜色统一风格 -->
<color name="text_click">#0174E1</color>
<color name="table_background">#cbcbcb</color>
<color name="background">#eaeaea</color>
<color name="light_white">#fcfcfc</color>
<color name="tab_main_color">#1e1d1d</color>
<color name="comm_bg">#eaeaea</color>
<!-- 加黑 -->
<color name="comm_text_black">#464646</color>
<!-- 常用左侧文字颜色 -->
<color name="comm_text_left">#3c3c3c</color>
<!-- 常用右侧文字颜色 -->
<color name="comm_text_right">#3c3c3c</color>
<color name="comm_text_red">#da1609</color>
<color name="comm_text_blue">#0f90e3</color>
<color name="comm_text_green">#66c058</color>
<color name="comm_text_yellow">#DAE532</color>
<color name="comm_button_blue">#0074E1</color>
<!-- 常用提示文字颜色 -->
<color name="comm_text_tips">#949494</color>
<!-- 分割线颜色 -->
<color name="comm_cutline">#c4c4c4</color>
<!-- 内容条目按下时的样式 -->
<color name="pressed_bg">#f2f2f2</color>
<color name="nopressed_bg">#fff</color>
<!-- 助手内容颜色 -->
<color name="title_content_color">#484848</color>
<color name="content_color">#7d7d7d</color>
<!-- 理财 -->
<color name="new_red">#D21A3E</color>
<color name="new_red_press">#B41131</color>
<color name="text_black">#515151</color>
<color name="text_left">#646464</color>
<color name="text_right">#a1a1a1</color>
<color name="text_gray">#b5b5b5</color>
<color name="cutline_gray">#c4c4c4</color>
<color name="text_yellow">#b18500</color>
<color name="btn_bg_gray">#f7f7f7</color>
<color name="new_green">#00FF99</color>
<!-- 首页快捷菜单 -->
<color name="menu_item_bg">#f6f6f6</color>
<color name="text_tips">#929292</color>
<!-- 账户总览 -->
<color name="text_left_account">#464646</color>
<color name="text_bom_account">#464646</color>
<!-- 品质生活 商品列表 -->
<color name="text_price_red">#ed3b3b</color>
<color name="text_sold_greay">#b0b0b0</color>
<color name="text_title_black">#232323</color>
<!-- 帮助中心-常见问题 -->
<color name="text_question">#333333</color>
<color name="text_answer">#777777</color>
<color name="result_view">#b0000000</color>
<color name="viewfinder_mask">#60000000</color>
<color name="possible_result_points">#c0ffff00</color>
<color name="transparent">#00000000</color>
<color name="comm_card_bg">#ffffff</color>
<color name="grey_50">#fafafa</color>
<color name="grey_200">#eeeeee</color>
<color name="btn_blue">#0067db</color>
<!-- 右边菜单点击颜色 -->
<color name="right_menu_unpressed">#CDCEC9</color>
<color name="right_menu_pressed">#C3C3C3</color>
<color name="menu_item_press">#2e000000</color>
<color name="page_backgroup">#f2f2f2</color>
<!-- 灰色 -->
<color name="grey_color1">#333333</color>
<color name="grey_color2">#666666</color>
<color name="grey_color3">#999999</color>
<!-- 橙色 -->
<color name="orange_color">#de6838</color>
</resources>
本文介绍了一个简单的购物车功能实现方案,包括商品展示、数量增减、全选/反选、总价计算等功能,并提供了完整的XML布局及Java代码示例。

1767

被折叠的 条评论
为什么被折叠?



