简体   繁体   English

将自定义图像视图设置为操作栏的菜单图标

[英]Setting custom image view as action bar's menu icon

I would like to add one of the menu icons of the action bar as below. 我想添加操作栏的菜单图标之一,如下所示。

在此输入图像描述

I need an icon and a bubble on top of that and I need to display a number on that at run time. 我需要一个图标和一个泡泡,我需要在运行时显示一个数字。 Is it possible to do? 有可能吗? I have Googled regarding this, but couldn't find exact way to do. 我有关于此的谷歌搜索,但找不到确切的方法。

Thanks in advance. 提前致谢。

what you want is call "badge" 你想要的是叫“徽章”

A simple way to "badge" any given Android view at runtime without having to cater for it in layout. 一种简单的方法,可以在运行时“标记”任何给定的Android视图,而无需在布局中满足它。

try this Lib 试试这个Lib

https://github.com/jgilfelt/android-viewbadger https://github.com/jgilfelt/android-viewbadger

您必须为此处的教程中提到的操作栏定义自定义布局,并在Imageview上方显示计数器,可以使用Android通知类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM