Android 图标右上角添加数字提醒
方法一:使用开源项目ViewBadger,github上的地址:https://github.com/jgilfelt/android-viewbadger
- <TextView
- android:id="@+id/tv1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="15dp"
- android:text="文本1" />
- <span style="font-family: Arial, Helvetica, sans-serif;"></span>
- tv = (TextView) findViewById(R.id.tv1);
- BadgeView badgeView = new BadgeView(MainActivity.this, tv); //实例化BadgeView
- badgeView.setText("12");
- // badgeView.setTextSize(8.5f); //设置文字的大小
- badgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);//设置在右上角
- badgeView.setTextColor(Color.DKGRAY); //字体的设置颜色
- badgeView.show(); //显示
这样就实现了上面的效果,注意引用开源项目ViewBadger时,要和新建的工程文件在同一个文件夹内,否则会出错的
方法二:用框架架构布局FrameLayout
- <FrameLayout
- android:id="@+id/frameLayout1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" >
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="10dp"
- android:text="文本2" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|right"
- android:background="#FF0000"
- android:text="23"
- android:textColor="@android:color/white" />
- </FrameLayout>
Android 图标右上角添加数字提醒的更多相关文章
- Android 图标上面添加提醒(二)使用开源UI类库 Viewbadger
版权声明:本文为博主原创文章,未经博主允许不得转载. 上一篇讲到用canvas进行绘制得到对应最终的bitmap. 在实际应用中,我们除了给图标添加数字外,也有可能加一些红色方块之类的图标作为新功能的 ...
- Android 为应用添加数字角标
今天在论坛上看到了一个帖子,终于搞清了我很久以来的一个困惑,android到底能不能实现ios的角标效果,QQ是怎么实现的.看了这个帖子顿时终于解除了我的困惑. 先说一个下大概的思路: 大家都知道an ...
- [收集]在iPhone桌面的应用程序图标右上角显示数字
能够在ios桌面的程序icon右上角显示数字(badge number)的方法 在ViewController中的viewDidLoad方法中添加如下代码即可 - (void)viewDidLoad ...
- Android 图标上面添加提醒(一)使用Canvas绘制
版权声明:本文为博主原创文章,未经博主允许不得转载. 在我们开发一些如通讯录.社交等应用或者应用添加新功能模块时,会考虑在对应的图标上加上未读信息的数量,或者是新功能提醒的图标,这样不占太大空间还能达 ...
- xamarin.android 给View控件 添加数字提醒效果-BadgeView
本文代码从java项目移植到.net项目 java开源项目:https://github.com/jgilfelt/android-viewbadger using System; using S ...
- Android 图标上面添加提醒使用开源UI类库 Viewbadger
Viewbadger 1.BadgeView主要是继承了TextView,所以实际上就是一个TextView,底层放了一个label,可以自定义背景图,自定义背景颜色,是否显示,显示进入的动画效果以及 ...
- icon上添加数字提醒
使用viewbadger包: package com.jingle.vierbagerstudy; import android.app.Activity; import android.os.Bun ...
- AJ学IOS(21)UIApplication设置程序图标右上⾓红⾊数字_联⺴指⽰器等
AJ分享,必须精品 效果简介 UIApplication的运用,有很多相如:进⾏行⼀一些应⽤用级别的操作等等,打开网页,打开电话拨号和信息等.. 什么是UIApplication ● UIApplic ...
- swift 如何在IOS应用图标上添加消息数
在应用图标右上角添加消息数提醒,可以很方便的告知用户该应用中有无新消息需要处理.下面用xcode 7.3.1来简要说明一下如何用swift语言进行此功能的实现. 1.修改 AppDelegate.sw ...
随机推荐
- Android安装 sdk+jdk+Eclipse+Adt开发工具
根据别人提供的手册和安装过程体验加以更新和详细描述 安装Android开发工具 开发Android应用程序的门坎并不高,因为Google已经为Android应用程序开发提供了免费而且跨平台的集成开发环 ...
- VIM中文乱码
下面是关于VIM中文乱码问题的解决方法: 打开VIM的配制文件在里面加上一段这样的代码就可以了: set encoding=prc
- python模块之paramiko
46.python模块之paramiko SSHClient 用于连接远程服务器并执行基本命令 基于用户名密码连接: 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
- [BZOJ - 2819] Nim 【树链剖分 / DFS序】
题目链接: BZOJ - 2819 题目分析 我们知道,单纯的 Nim 的必胜状态是,各堆石子的数量异或和不为 0 .那么这道题其实就是要求求出树上的两点之间的路径的异或和.要求支持单点修改. 方法一 ...
- A Statistical View of Deep Learning (I): Recursive GLMs
A Statistical View of Deep Learning (I): Recursive GLMs Deep learningand the use of deep neural netw ...
- Cognos请求流程——<转>
访问Cognos8 匿名访问 用户通过浏览器发起Cognos访问请求,请求被送至Cognos Gateway Gateway接收请求并发送给一个dispatcher dispatcher发现请求没有附 ...
- IOS中用模型取代字典的好处
使用字典的坏处 一般情况下,设置数据和取出数据都是用“字符串类型的key”,编写这些key时,编译器不会有任何友情提示,需要手敲 dict[@“name”]=@“Kevin”; NSString *n ...
- BS_OWNERDRAW风格的作用和例子,值得研究~
TBitBtn就是一个例子: procedure TBitBtn.CreateParams(var Params: TCreateParams); begin inherited CreatePara ...
- c# 哈希表集合;函数
* 哈希表集合 1.先进去的后出来,最后进去的先出来 2.利用枚举类型打印出集合中的Key值和Value值 ** 函数 1.函数:能够独立完成某项功能的模块. 函数四要素:输入.输出.函数体.函数名 ...
- Lesson 6: CronTrigger
CronTrigger is often more useful than SimpleTrigger, if you need a job-firing schedule that recurs b ...