มีสัญลักษณ์หรือวิธีมาตรฐาน Android เพื่อแสดงไอคอนการแจ้งเตือนของแถบการกระทำที่มีจำนวนเหมือนในตัวอย่างของ Google หรือไม่?

ถ้าไม่เช่นนั้นวิธีที่ดีที่สุดที่จะทำคืออะไร? 
ฉันใหม่สำหรับ Android โปรดช่วยด้วย
มีสัญลักษณ์หรือวิธีมาตรฐาน Android เพื่อแสดงไอคอนการแจ้งเตือนของแถบการกระทำที่มีจำนวนเหมือนในตัวอย่างของ Google หรือไม่?

ถ้าไม่เช่นนั้นวิธีที่ดีที่สุดที่จะทำคืออะไร? 
ฉันใหม่สำหรับ Android โปรดช่วยด้วย
คำตอบ:
ฉันไม่แน่ใจว่านี่เป็นทางออกที่ดีที่สุดหรือไม่ แต่เป็นสิ่งที่ฉันต้องการ
โปรดบอกฉันหากคุณรู้ว่าต้องเปลี่ยนอะไรเพื่อประสิทธิภาพหรือคุณภาพที่ดีขึ้น ในกรณีของฉันฉันมีปุ่ม
รายการที่กำหนดเองในเมนูของฉัน - main.xml
<item
    android:id="@+id/badge"
    android:actionLayout="@layout/feed_update_count"
    android:icon="@drawable/shape_notification"
    android:showAsAction="always">
</item>รูปร่างที่กำหนดเอง drawable (สี่เหลี่ยมพื้นหลัง) - shape_notification.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">
    <stroke android:color="#22000000" android:width="2dp"/>
    <corners android:radius="5dp" />
    <solid android:color="#CC0001"/>
</shape>เค้าโครงสำหรับมุมมองของฉัน - feed_update_count.xml
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/notif_count"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:minWidth="32dp"
     android:minHeight="32dp"
     android:background="@drawable/shape_notification"
     android:text="0"
     android:textSize="16sp"
     android:textColor="@android:color/white"
     android:gravity="center"
     android:padding="2dp"
     android:singleLine="true">    
</Button>MainActivity - การตั้งค่าและปรับปรุงมุมมองของฉัน
static Button notifCount;
static int mNotifCount = 0;    
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.main, menu);
    View count = menu.findItem(R.id.badge).getActionView();
    notifCount = (Button) count.findViewById(R.id.notif_count);
    notifCount.setText(String.valueOf(mNotifCount));
    return super.onCreateOptionsMenu(menu);
}
private void setNotifCount(int count){
    mNotifCount = count;
    invalidateOptionsMenu();
}MenuItem item = menu.findItem(R.id.badge); 		MenuItemCompat.setActionView(item, R.layout.feed_update_count); 		notifCount = (Button) MenuItemCompat.getActionView(item);
                    android:icon="..."XML ในรายการเมนู android:actionLayout="..."มีเพียงพอ สำหรับButtonXML ในโครงร่างคุณสามารถใช้แท็กปิดตัวเองได้<Button ... />เนื่องจากแท็กไม่สามารถมีเนื้อหาได้ คุณต้องปิด<shape>แท็ก (อีกครั้ง: ปิดตัวเอง) invalidateOptionsMenu()และคุณไม่จำเป็นต้อง สำหรับฉันแล้วมันใช้งานไม่ได้เนื่องจากตราสัญลักษณ์นั้นสูงเกินจริงจาก XML อีกครั้ง ดังนั้นทั้งหมดsetNotifCount(...)ไม่มีประโยชน์ เพียงโทรหาsetText(...)ป้าย และคุณสามารถโยนgetActionView()ไปButtonโดยตรง
                    แก้ไขตั้งแต่เวอร์ชัน 26 ของไลบรารีการสนับสนุน (หรือ androidx) คุณไม่จำเป็นต้องปรับใช้แบบกำหนดเองOnLongClickListenerเพื่อแสดงคำแนะนำเครื่องมืออีกต่อไป เรียกสิ่งนี้ว่า:
TooltipCompat.setTooltipText(menu_hotlist, getString(R.string.hint_show_hot_message));ฉันจะแบ่งปันรหัสของฉันในกรณีที่มีคนต้องการสิ่งนี้:

รูปแบบ / เมนู / menu_actionbar.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    <item android:id="@+id/menu_hotlist"
        android:actionLayout="@layout/action_bar_notifitcation_icon"
        android:showAsAction="always"
        android:icon="@drawable/ic_bell"
        android:title="@string/hotlist" />
    ...
</menu>รูปแบบ / action_bar_notifitcation_icon.xml
สไตล์โน้ตและแอนดรอยด์:คุณสมบัติที่คลิกได้ สิ่งเหล่านี้ทำให้เค้าโครงขนาดของปุ่มและทำให้พื้นหลังเป็นสีเทาเมื่อสัมผัส
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_gravity="center"
    android:clickable="true"
    style="@android:style/Widget.ActionButton">
    <ImageView
        android:id="@+id/hotlist_bell"
        android:src="@drawable/ic_bell"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_margin="0dp"
        android:contentDescription="bell"
        />
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/hotlist_hot"
        android:layout_width="wrap_content"
        android:minWidth="17sp"
        android:textSize="12sp"
        android:textColor="#ffffffff"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@null"
        android:layout_alignTop="@id/hotlist_bell"
        android:layout_alignRight="@id/hotlist_bell"
        android:layout_marginRight="0dp"
        android:layout_marginTop="3dp"
        android:paddingBottom="1dp"
        android:paddingRight="4dp"
        android:paddingLeft="4dp"
        android:background="@drawable/rounded_square"/>
</RelativeLayout>drawable-XHDPI / ic_bell.png
ภาพขนาด 64x64 พิกเซลพร้อมช่องว่างกว้าง 10 พิกเซลจากทุกด้าน คุณควรจะมีช่องว่างขนาดกว้าง 8 พิกเซล แต่ฉันพบว่ารายการเริ่มต้นส่วนใหญ่มีขนาดเล็กกว่านั้นเล็กน้อย แน่นอนคุณจะต้องใช้ขนาดที่แตกต่างกันสำหรับความหนาแน่นที่แตกต่างกัน
drawable / rounded_square.xml
ที่นี่ # ff222222 (color # 222222 พร้อม alpha #ff (มองเห็นได้อย่างสมบูรณ์)) เป็นสีพื้นหลังของแถบการกระทำของฉัน
<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="2dp" />
    <solid android:color="#ffff0000" />
    <stroke android:color="#ff222222" android:width="2dp"/>
</shape>co.th / ubergeek42 / WeechatAndroid / WeechatActivity.java
ที่นี่เราทำให้คลิกได้และอัพเดทได้! ฉันสร้างฟังนามธรรมที่ให้สร้างบนขนมปังปิ้ง onLongClick รหัสถูกนำมาจากจากแหล่งที่มาของ ActionBarSherlock
private int hot_number = 0;
private TextView ui_hot = null;
@Override public boolean onCreateOptionsMenu(final Menu menu) {
    MenuInflater menuInflater = getSupportMenuInflater();
    menuInflater.inflate(R.menu.menu_actionbar, menu);
    final View menu_hotlist = menu.findItem(R.id.menu_hotlist).getActionView();
    ui_hot = (TextView) menu_hotlist.findViewById(R.id.hotlist_hot);
    updateHotCount(hot_number);
    new MyMenuItemStuffListener(menu_hotlist, "Show hot message") {
        @Override
        public void onClick(View v) {
            onHotlistSelected();
        }
    };
    return super.onCreateOptionsMenu(menu);
}
// call the updating code on the main thread,
// so we can call this asynchronously
public void updateHotCount(final int new_hot_number) {
    hot_number = new_hot_number;
    if (ui_hot == null) return;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (new_hot_number == 0)
                ui_hot.setVisibility(View.INVISIBLE);
            else {
                ui_hot.setVisibility(View.VISIBLE);
                ui_hot.setText(Integer.toString(new_hot_number));
            }
        }
    });
}
static abstract class MyMenuItemStuffListener implements View.OnClickListener, View.OnLongClickListener {
    private String hint;
    private View view;
    MyMenuItemStuffListener(View view, String hint) {
        this.view = view;
        this.hint = hint;
        view.setOnClickListener(this);
        view.setOnLongClickListener(this);
    }
    @Override abstract public void onClick(View v);
    @Override public boolean onLongClick(View v) {
        final int[] screenPos = new int[2];
        final Rect displayFrame = new Rect();
        view.getLocationOnScreen(screenPos);
        view.getWindowVisibleDisplayFrame(displayFrame);
        final Context context = view.getContext();
        final int width = view.getWidth();
        final int height = view.getHeight();
        final int midy = screenPos[1] + height / 2;
        final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
        Toast cheatSheet = Toast.makeText(context, hint, Toast.LENGTH_SHORT);
        if (midy < displayFrame.height()) {
            cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,
                    screenWidth - screenPos[0] - width / 2, height);
        } else {
            cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
        }
        cheatSheet.show();
        return true;
    }
}app:actionLayout="@layout/action_bar_notifitcation_icon"แทนandroid:actionLayout="@layout/action_bar_notifitcation_icon"ถ้าคุณจะใช้MenuItemCompat.getActionViewแทนmenu.findItem(R.id.menu_hotlist).getActionView();สำหรับปัญหาความเข้ากันได้ MenuItem.getActionViewเข้ากันไม่ได้กับระดับ API <11
                    android:actionLayout; AppCompat: app:actionLayoutในรายการเมนูของคุณ
                    เพียงเพิ่ม หากมีคนต้องการใช้วงกลมฟองที่เต็มไปด้วยให้ใส่รหัส (ตั้งชื่อbage_circle.xml):
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="ring"
    android:useLevel="false"
    android:thickness="9dp"
    android:innerRadius="0dp"
    >
    <solid
        android:color="#F00"
        />
    <stroke
        android:width="1dip"
        android:color="#FFF" />
    <padding
        android:top="2dp"
        android:bottom="2dp"/>
</shape>คุณอาจต้องปรับความหนาตามความต้องการของคุณ

แก้ไข: 
นี่คือเค้าโครงสำหรับปุ่ม (ตั้งชื่อbadge_layout.xml):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <com.joanzapata.iconify.widget.IconButton
        android:layout_width="44dp"
        android:layout_height="44dp"
        android:textSize="24sp"
        android:textColor="@color/white"
        android:background="@drawable/action_bar_icon_bg"
        android:id="@+id/badge_icon_button"/>
    <TextView
        android:id="@+id/badge_textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@id/badge_icon_button"
        android:layout_alignRight="@id/badge_icon_button"
        android:layout_alignEnd="@id/badge_icon_button"
        android:text="10"
        android:paddingEnd="8dp"
        android:paddingRight="8dp"
        android:paddingLeft="8dp"
        android:gravity="center"
        android:textColor="#FFF"
        android:textSize="11sp"
        android:background="@drawable/badge_circle"/>
</RelativeLayout>ในเมนูสร้างรายการ:
<item
        android:id="@+id/menu_messages"
        android:showAsAction="always"
        android:actionLayout="@layout/badge_layout"/>ใน onCreateOptionsMenuรับการอ้างอิงถึงรายการเมนู:
    itemMessages = menu.findItem(R.id.menu_messages);
    badgeLayout = (RelativeLayout) itemMessages.getActionView();
    itemMessagesBadgeTextView = (TextView) badgeLayout.findViewById(R.id.badge_textView);
    itemMessagesBadgeTextView.setVisibility(View.GONE); // initially hidden
    iconButtonMessages = (IconButton) badgeLayout.findViewById(R.id.badge_icon_button);
    iconButtonMessages.setText("{fa-envelope}");
    iconButtonMessages.setTextColor(getResources().getColor(R.color.action_bar_icon_color_disabled));
    iconButtonMessages.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (HJSession.getSession().getSessionId() != null) {
                Intent intent = new Intent(getThis(), HJActivityMessagesContexts.class);
                startActivityForResult(intent, HJRequestCodes.kHJRequestCodeActivityMessages.ordinal());
            } else {
                showLoginActivity();
            }
        }
    });หลังจากได้รับการแจ้งเตือนสำหรับข้อความให้ตั้งค่าการนับ:
itemMessagesBadgeTextView.setText("" + count);
itemMessagesBadgeTextView.setVisibility(View.VISIBLE);
iconButtonMessages.setTextColor(getResources().getColor(R.color.white));compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.+'ฉันไม่ชอบActionViewโซลูชันที่ใช้แนวคิดของฉันคือ:
TextViewซึ่งTextViewจะถูกบรรจุโดยแอปพลิเคชันเมื่อคุณต้องการวาดMenuItem:
2.1 เค้าโครงพอง
2.2 โทรmeasure()& layout()(มิฉะนั้นviewจะเป็น 0px x 0px มันเล็กเกินไปสำหรับกรณีใช้งานส่วนใหญ่)
2.3 ตั้งค่าTextViewข้อความของ
2.4 ทำ "ภาพหน้าจอ" ของมุมมอง
2.6 MenuItemไอคอนของชุดตามบิตแมปที่สร้างขึ้นใน 2.4
กำไร!
ดังนั้นผลลัพธ์ควรเป็นเช่นนั้น

<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/counterPanel" android:layout_width="32dp" android:layout_height="32dp" android:background="@drawable/ic_menu_gallery"> <RelativeLayout android:id="@+id/counterValuePanel" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/counterBackground" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/unread_background" /> <TextView android:id="@+id/count" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1" android:textSize="8sp" android:layout_centerInParent="true" android:textColor="#FFFFFF" /> </RelativeLayout> </FrameLayout>
@drawable/unread_backgroundเป็นTextViewพื้นหลังสีเขียวซึ่ง 
 @drawable/ic_menu_galleryไม่จำเป็นจริงๆที่นี่เพียงเพื่อแสดงตัวอย่างผลลัพธ์ของเค้าโครงใน IDE
เพิ่มรหัสลงในonCreateOptionsMenu/onPrepareOptionsMenu
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    MenuItem menuItem = menu.findItem(R.id.testAction);
    menuItem.setIcon(buildCounterDrawable(count, R.drawable.ic_menu_gallery));
    return true;
}ใช้วิธีการ build-the-icon:
private Drawable buildCounterDrawable(int count, int backgroundImageId) {
    LayoutInflater inflater = LayoutInflater.from(this);
    View view = inflater.inflate(R.layout.counter_menuitem_layout, null);
    view.setBackgroundResource(backgroundImageId);
    if (count == 0) {
        View counterTextPanel = view.findViewById(R.id.counterValuePanel);
        counterTextPanel.setVisibility(View.GONE);
    } else {
        TextView textView = (TextView) view.findViewById(R.id.count);
        textView.setText("" + count);
    }
    view.measure(
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.setDrawingCacheEnabled(true);
    view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
    Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
    view.setDrawingCacheEnabled(false);
    return new BitmapDrawable(getResources(), bitmap);
}รหัสทั้งหมดอยู่ที่นี่: https://github.com/cvoronin/ActionBarMenuItemCounter
ตกลงสำหรับโซลูชัน@AndrewSเพื่อทำงานกับv7 appCompat library :
<menu 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:someNamespace="http://schemas.android.com/apk/res-auto" >
    <item
        android:id="@+id/saved_badge"
        someNamespace:showAsAction="always"
        android:icon="@drawable/shape_notification" />
</menu>.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();
    inflater.inflate(R.menu.main, menu);
    MenuItem item = menu.findItem(R.id.saved_badge);
    MenuItemCompat.setActionView(item, R.layout.feed_update_count);
    View view = MenuItemCompat.getActionView(item);
    notifCount = (Button)view.findViewById(R.id.notif_count);
    notifCount.setText(String.valueOf(mNotifCount));
}
private void setNotifCount(int count){
    mNotifCount = count;
    supportInvalidateOptionsMenu();
}ส่วนที่เหลือของรหัสจะเหมือนกัน
android:actionLayoutเป็นapp:actionLayoutมันใช้งานได้เหมือนมีเสน่ห์
                    ลองดูคำตอบของคำถามเหล่านี้โดยเฉพาะคำถามที่สองซึ่งมีรหัสตัวอย่าง:
วิธีการนำค่าไดนามิกไปใช้กับรายการเมนูใน Android
วิธีรับข้อความบนไอคอน ActionBar
จากสิ่งที่ฉันเห็นคุณจะต้องสร้างActionViewการใช้งานที่กำหนดเองของคุณเอง ทางเลือกอาจเป็นแบบกำหนดเองDrawableทางเลือกที่อาจจะมีการกำหนดเองโปรดทราบว่าดูเหมือนว่าจะไม่มีการใช้งานการนับการแจ้งเตือนสำหรับ Action Bar
แก้ไข: คำตอบที่คุณกำลังมองหาด้วยรหัส: มุมมองการแจ้งเตือนที่กำหนดเองด้วยการใช้ตัวอย่าง
Drawableเป็น s ตามที่เห็นในลิงก์สองลิงก์ต่อไปนี้: stackoverflow.com/questions/6691818/…และstackoverflow.com/questions/3972445/…
                    Drawableผ่านสิ่งต่างๆเช่นลิงก์ที่นี่จากนั้นสร้างแอททริบิวสำหรับกำหนดเองของคุณDrawableที่มีข้อความอยู่เหนือเพื่อให้คุณสามารถสร้างได้ทั้งหมด ใน XML และพอดีกับที่คุณต้องการ อีกทางหนึ่งคุณสามารถเพิ่ม Drawable ใน Java ได้ถ้ามันยากเกินไป
                    เมื่อคุณใช้แถบเครื่องมือ:
....
private void InitToolbar() {
    toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    toolbartitle = (TextView) findViewById(R.id.titletool);
    toolbar.inflateMenu(R.menu.show_post);
    toolbar.setOnMenuItemClickListener(this);
    Menu menu = toolbar.getMenu();
    MenuItem menu_comments = menu.findItem(R.id.action_comments);
    MenuItemCompat
            .setActionView(menu_comments, R.layout.menu_commentscount);
    View v = MenuItemCompat.getActionView(menu_comments);
    v.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            // Your Action
        }
    });
    comment_count = (TextView) v.findViewById(R.id.count);
}และในการเรียกโหลดข้อมูลรีเฟรชเมนู ():
private void refreshMenu() {
    comment_count.setVisibility(View.VISIBLE);
    comment_count.setText("" + post_data.getComment_count());
}ฉันพบทางออกที่ดีมากที่นี่ฉันใช้กับ kotlin
ก่อนอื่นในโฟลเดอร์ drawable คุณต้องสร้างitem_count.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="#f20000" />
<stroke
    android:width="2dip"
    android:color="#FFF" />
<padding
    android:bottom="5dp"
    android:left="5dp"
    android:right="5dp"
    android:top="5dp" />
</shape>ในเลย์เอาต์ของคุณActivity_Mainมีลักษณะเช่น:
<RelativeLayout
                    android:id="@+id/badgeLayout"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_toRightOf="@+id/badge_layout1"
                    android:layout_gravity="end|center_vertical"
                    android:layout_marginEnd="5dp">
                <RelativeLayout
                        android:id="@+id/relative_layout1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                    <Button
                            android:id="@+id/btnBadge"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:background="@mipmap/ic_notification" />
                </RelativeLayout>
                <TextView
                        android:id="@+id/txtBadge"
                        android:layout_width="18dp"
                        android:layout_height="18dp"
                        android:layout_alignRight="@id/relative_layout1"
                        android:background="@drawable/item_count"
                        android:text="22"
                        android:textColor="#FFF"
                        android:textSize="7sp"
                        android:textStyle="bold"
                        android:gravity="center"/>
            </RelativeLayout>และคุณสามารถปรับเปลี่ยนเช่น:
btnBadge.setOnClickListener { view ->
        Snackbar.make(view,"badge click", Snackbar.LENGTH_LONG) .setAction("Action", null).show()
        txtBadge.text = "0"
    }ฉันพบวิธีที่ดีกว่าที่จะทำ ถ้าคุณต้องการใช้สิ่งนี้
ใช้การพึ่งพานี้
   compile 'com.nex3z:notification-badge:0.1.0'สร้างไฟล์ xml หนึ่งไฟล์ในรูปวาดได้และบันทึกเป็น Badge.xml
<?xml version="1.0" encoding="utf-8"?>
  <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="oval">
        <solid android:color="#66000000"/>
        <size android:width="30dp" android:height="40dp"/>
    </shape>
</item>
<item android:bottom="1dp" android:right="0.6dp">
    <shape android:shape="oval">
        <solid android:color="@color/Error_color"/>
        <size android:width="20dp" android:height="20dp"/>
    </shape>
</item>
</layer-list>ตอนนี้ไม่ว่าคุณจะต้องการใช้ตราสัญลักษณ์ใดให้ใช้รหัสต่อไปนี้ใน xml ด้วยความช่วยเหลือของสิ่งนี้คุณจะสามารถเห็นป้ายนั้นที่มุมบนขวาของภาพหรืออะไรก็ได้
  <com.nex3z.notificationbadge.NotificationBadge
    android:id="@+id/badge"
    android:layout_toRightOf="@id/Your_ICON/IMAGE"
    android:layout_alignTop="@id/Your_ICON/IMAGE"
    android:layout_marginLeft="-16dp"
    android:layout_marginTop="-8dp"
    android:layout_width="28dp"
    android:layout_height="28dp"
    app:badgeBackground="@drawable/Badge"
    app:maxTextLength="2"
    ></com.nex3z.notificationbadge.NotificationBadge>ตอนนี้ใน yourFile.java ใช้ 2 สิ่งง่าย ๆ .. 1) กำหนด
 NotificationBadge mBadge;2) ที่วงของคุณหรืออะไรก็ตามที่นับจำนวนนี้ใช้สิ่งนี้:
 mBadge.setNumber(your_LoopCount);ที่นี่   mBadge.setNumber(0)จะไม่แสดงอะไรเลย
หวังว่าความช่วยเหลือนี้