Little Red dots on your Android shopping cart

Source: Internet
Author: User

Tagged with: Android UI on Android shopping Cart

The number of small red dots on the shopping cart has baffled 2 colleagues or kankan to solve them.

First look at the layout, the Includelayout loading a top menu bar




The specific layout file of the menu

<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= "Home"
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= "Back"
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= "Features"
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, direct SetText can be


Little Red dots on your Android shopping cart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.