Red dot in the android shopping cart and Android shopping cart
The number of small red dots purchased in the shopping cart is hard to solve by two colleagues or kankan.
First, let's look at the layout. Add a top menu bar to the eincludelayout.
Specific menu layout File
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Xmlns: tools = "http://schemas.android.com/tools"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: background = "@ color/bg_1">
<TextView
Android: id = "@ + id/v_title_text_score"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: layout_centerInParent = "true"
Android: gravity = "center"
Android: padding = "10dp"
Android: text = "Homepage"
Android: textColor = "@ color/text_title"
Android: textSize = "@ dimen/text_size_18"/>
<TextView
Android: id = "@ + id/v_title_left_score"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentLeft = "true"
Android: layout_centerVertical = "true"
Android: padding = "10dp"
Android: text = "return"
Android: textColor = "@ color/text_color_2"
Android: textSize = "@ dimen/text_size_16"
Android: visibility = "gone"/>
<! -- <ImageView
Android: id = "@ + id/v_title_left_img_score"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentLeft = "true"
Android: layout_centerVertical = "true"
Android: padding = "10dp"
Android: src = "@ drawable/title_left_img"
Android: visibility = "visible"/> -->
<ImageView
Android: id = "@ + id/v_title_left_img_score"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentLeft = "true"
Android: layout_centerVertical = "true"
Android: src = "@ drawable/title_left_img"
Android: adjustViewBounds = "true"
Android: maxWidth = "35dp"
Android: maxHeight = "30dp"
Android: layout_marginLeft = "10dp"
Android: scaleType = "fitXY"
Android: visibility = "visible"/>
<TextView
Android: id = "@ + id/v_title_right_score"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentRight = "true"
Android: layout_centerVertical = "true"
Android: padding = "10dp"
Android: text = "function"
Android: textColor = "@ color/text_color_2"
Android: textSize = "@ dimen/text_size_16"
Android: visibility = "gone"/>
<ImageView
Android: id = "@ + id/v_title_right_cart"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentRight = "true"
Android: layout_centerVertical = "true"
Android: layout_marginRight = "14dp"
Android: src = "@ drawable/score_cart_empty"/>
<TextView
Android: id = "@ + id/v_title_right_number"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentRight = "true"
Android: layout_marginRight = "8dp"
Android: layout_marginTop = "2dp"
Android: gravity = "center_horizontal"
Android: layout_alignParentTop = "true"
Android: background = "@ drawable/score_top_icon3"
Android: padding = "2dp"
Android: textAlignment = "textEnd"
Android: text = "9"
Android: textColor = "@ color/white"
Android: textSize = "8sp"
Android: visibility = "gone"/>
</RelativeLayout>
Java code
Change the quantity and set the value to setText.
Android shopping cart creation assistance
You must first make the layout of this interface. images, text, prices, and so on are all obtained from the server and then filled in the listview with baseadapter, finally, we can handle the event of the corresponding control.
Why is there no problem in my mobile phone Android system? The system will jump out and prompt a shopping cart icon in the upper left corner. We recommend that you download your text message and never delete it if you don't click it.
Just uninstall the "virtual data cable" software. I had to endure the bid of a very good software.