Android BGABadgeView:BGABadgeFrameLayout(5)
Android BGABadgeView:BGABadgeFrameLayout(5)
BGABadgeView除了有自己的线性布局,相对布局外(见附录文章7,8),还实现了FrameLayout。写一个简单例子,布局文件:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@mipmap/ic_launcher"
- android:orientation="vertical">
- <cn.bingoogolapple.badgeview.BGABadgeFrameLayout
- android:id="@+id/badgeLayout"
- android:layout_width="match_parent"
- android:layout_height="200dp"
- android:layout_margin="15dp"
- android:background="#CCFFFFFF"
- app:badge_borderColor="@android:color/black"
- app:badge_borderWidth="2dp"
- app:badge_gravity="rightTop"
- app:badge_padding="10dp"></cn.bingoogolapple.badgeview.BGABadgeFrameLayout>
- <TextView
- android:id="@+id/text"
- android:layout_width="match_parent"
- android:layout_height="200dp"
- android:layout_margin="15dp"
- android:background="#64000000"
- android:gravity="center"
- android:text="zhang phil @ csdn"
- android:textColor="@android:color/white" />
- </LinearLayout>
Java代码很简单:
- package zhangphil.demo;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.widget.TextView;
- import cn.bingoogolapple.badgeview.BGABadgeFrameLayout;
- public class MainActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- BGABadgeFrameLayout frameLayout= (BGABadgeFrameLayout) findViewById(R.id.badgeLayout);
- frameLayout.showCirclePointBadge();
- TextView text= (TextView) findViewById(R.id.text);
- //Color.argb(100, 0, 0, 0),相当于背景中的#64000000
- //text.setBackgroundColor(Color.argb(100, 0, 0, 0));
- }
- }
代码运行结果:
附录文章:
1,《仿微信、短信、QQ等消息数目右上角红色小圆球气泡显示(基于Android XML布局文件实现)》链接地址:http://blog.csdn.net/zhangphil/article/details/43702953
2,《仿短信条目右上角的红色小圆球提示气泡》链接地址:http://blog.csdn.net/zhangphil/article/details/43667727
3,《Android开源BezierView:仿QQ未读消息99+条的红色气泡》链接地址:http://blog.csdn.net/zhangphil/article/details/49746709
4,《Android RoundedBitmapDrawable:Android官方的圆角图形图象实现方案》链接地址:http://blog.csdn.net/zhangphil/article/details/51829650
5,《Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1)》链接地址:http://blog.csdn.net/zhangphil/article/details/51822514
6,《Android BGABadgeView:显示提示数字(2)》链接地址:http://blog.csdn.net/zhangphil/article/details/51828808
7,《Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3)》链接地址:http://blog.csdn.net/zhangphil/article/details/51828968
8,《Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4)》链接地址:http://blog.csdn.net/zhangphil/article/details/51830489
Android BGABadgeView:BGABadgeFrameLayout(5)的更多相关文章
- Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4)
Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4) 在附录文章5,6,7的基础上,写一个小例子说明BGABadge ...
- Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3)
Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3) Android BGABadgeView不仅可以把某个View作为B ...
- Android BGABadgeView:显示提示数字(2)
Android BGABadgeView:显示提示数字(2) 在附录文章3的基础上,对代码进行稍微改造,显示在红色小圆球内部显示数字,同时给红色小圆球通过可编程调控红色小圆球的整体外观,布局文件 ...
- Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1)
Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1) 现在很多的APP会有新消息/未接来电/未读消息/新通知圆球红点提示,典型的以微信.QQ新消息提示为 ...
- Android的Kotlin秘方(I):OnGlobalLayoutListener
春节后,又重新“开张”.各位高手请继续支持.谢谢! 原文标题:Kotlin recipes for Android (I): OnGlobalLayoutListener 原文链接:http://an ...
- Android的init过程(二):初始化语言(init.rc)解析
Android的init过程(一) 本文使用的软件版本 Android:4.2.2 Linux内核:3.1.10 在上一篇文章中介绍了init的初始化第一阶段,也就是处理各种属性.在本文将会详细分析i ...
- Android的init过程(二):初始化语言(init.rc)解析【转】
转自:http://www.cnblogs.com/nokiaguy/p/3164799.html Android的init过程(一) 本文使用的软件版本 Android:4.2.2 Linux内核: ...
- Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog)
Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog) Android第三方开源对话消息提示框:SweetAlertDialog(sweet- ...
- Android进阶笔记04:Android进程间通讯(IPC)之Messenger
一. Android进程间通讯之Messenger 的引入 (1)引言: 平时一说进程间通讯,大家都会想到AIDL,其实messenger和AIDL作用一样,都可以进行进程间通讯.它是基于消 ...
随机推荐
- shell脚本从入门到精通
阿里云大学 shell脚本从入门到精通 第1 章 : shell脚本编程-变量-算术表达式-判断语句-if分支语句 第2 章 : case-for-While-双括号-循环嵌套-break-conti ...
- 数学 Codeforces Round #282 (Div. 2) B. Modular Equations
题目传送门 题意:a % x == b,求符合条件的x有几个 数学:等式转换为:a == nx + b,那么设k = nx = a - b,易得k的约数(>b)的都符合条件,比如a=25 b=1 ...
- stack(数组模拟) POJ 2559 Largest Rectangle in a Histogram
题目传送门 /* 题意:宽度为1,高度不等,求最大矩形面积 stack(数组模拟):对于每个a[i]有L[i],R[i]坐标位置 表示a[L[i]] < a[i] < a[R[i]] 的极 ...
- 题解报告:hdu 1235 统计同成绩学生人数
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1235 Problem Description 读入N名学生的成绩,将获得某一给定分数的学生人数输出. ...
- Lync客户端证书安装
安装完Lync客户端后,运行时Lync客户端时,报出如下错误: [原因解析] Lync客户端没有正确安装CA证书链. [解决办法] 第一种方法:将计算机加入域. 第二种方法:不加入域的处理方法: 1. ...
- 【Python】高级函数
1.Filter函数 def is_odd(x): return x % 2 == 1 #将列表中所有的奇数筛选出来 print(list(filter(is_odd,[1,2,3,4,5,6,7]) ...
- Android嵌入式安卓触摸屏|4418开发板平台
核心板参数 尺寸:50mm*60mm 高度:核心板连接器为1.5mm 4418 CPU:ARM Cortex-A9 四核 S5P4418处理器 1.4GHz 6818 CPU:ARM Cortex-A ...
- 软件开发:速度 vs 质量
程序开发项目进行过程中,通常会冒出这样的困惑:应该选择速度,还是选择质量?很多程序猿都会有偷懒的思维,觉得把一些摸不清头绪.不知道怎么写的代码片段去掉,可以节省很多时间,更早完成项目计划. 其实过去几 ...
- springboot学习笔记(二)
首先我们来看一看,springboot启动类@RestController//@ResponseBody+@Controller@SpringBootApplicationpublic class H ...
- Java处理ZIP文件的解决方案——Zip4J(不解压直接通过InputStream形式读取其中的文件,解决中文乱码)
一.JDK内置操作Zip文件其实,在JDK中已经存在操作ZIP的工具类:ZipInputStream. 基本使用: public static Map<String, String> re ...