Android BGABadgeView:BGABadgeFrameLayout(5)

BGABadgeView除了有自己的线性布局,相对布局外(见附录文章7,8),还实现了FrameLayout。写一个简单例子,布局文件:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:background="@mipmap/ic_launcher"
  7. android:orientation="vertical">
  8.  
  9. <cn.bingoogolapple.badgeview.BGABadgeFrameLayout
  10. android:id="@+id/badgeLayout"
  11. android:layout_width="match_parent"
  12. android:layout_height="200dp"
  13. android:layout_margin="15dp"
  14. android:background="#CCFFFFFF"
  15. app:badge_borderColor="@android:color/black"
  16. app:badge_borderWidth="2dp"
  17. app:badge_gravity="rightTop"
  18. app:badge_padding="10dp"></cn.bingoogolapple.badgeview.BGABadgeFrameLayout>
  19.  
  20. <TextView
  21. android:id="@+id/text"
  22. android:layout_width="match_parent"
  23. android:layout_height="200dp"
  24. android:layout_margin="15dp"
  25. android:background="#64000000"
  26. android:gravity="center"
  27. android:text="zhang phil @ csdn"
  28. android:textColor="@android:color/white" />
  29.  
  30. </LinearLayout>

Java代码很简单:

  1. package zhangphil.demo;
  2.  
  3. import android.support.v7.app.AppCompatActivity;
  4. import android.os.Bundle;
  5. import android.widget.TextView;
  6.  
  7. import cn.bingoogolapple.badgeview.BGABadgeFrameLayout;
  8.  
  9. public class MainActivity extends AppCompatActivity {
  10.  
  11. @Override
  12. protected void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.activity_main);
  15.  
  16. BGABadgeFrameLayout frameLayout= (BGABadgeFrameLayout) findViewById(R.id.badgeLayout);
  17. frameLayout.showCirclePointBadge();
  18.  
  19. TextView text= (TextView) findViewById(R.id.text);
  20. //Color.argb(100, 0, 0, 0),相当于背景中的#64000000
  21. //text.setBackgroundColor(Color.argb(100, 0, 0, 0));
  22. }
  23. }

代码运行结果:

附录文章:

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)的更多相关文章

  1. Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4)

     Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4) 在附录文章5,6,7的基础上,写一个小例子说明BGABadge ...

  2. Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3)

     Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3) Android BGABadgeView不仅可以把某个View作为B ...

  3. Android BGABadgeView:显示提示数字(2)

     Android BGABadgeView:显示提示数字(2) 在附录文章3的基础上,对代码进行稍微改造,显示在红色小圆球内部显示数字,同时给红色小圆球通过可编程调控红色小圆球的整体外观,布局文件 ...

  4. Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1)

     Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1) 现在很多的APP会有新消息/未接来电/未读消息/新通知圆球红点提示,典型的以微信.QQ新消息提示为 ...

  5. Android的Kotlin秘方(I):OnGlobalLayoutListener

    春节后,又重新“开张”.各位高手请继续支持.谢谢! 原文标题:Kotlin recipes for Android (I): OnGlobalLayoutListener 原文链接:http://an ...

  6. Android的init过程(二):初始化语言(init.rc)解析

    Android的init过程(一) 本文使用的软件版本 Android:4.2.2 Linux内核:3.1.10 在上一篇文章中介绍了init的初始化第一阶段,也就是处理各种属性.在本文将会详细分析i ...

  7. Android的init过程(二):初始化语言(init.rc)解析【转】

    转自:http://www.cnblogs.com/nokiaguy/p/3164799.html Android的init过程(一) 本文使用的软件版本 Android:4.2.2 Linux内核: ...

  8. Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog)

    Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog) Android第三方开源对话消息提示框:SweetAlertDialog(sweet- ...

  9. Android进阶笔记04:Android进程间通讯(IPC)之Messenger

    一. Android进程间通讯之Messenger 的引入 (1)引言:      平时一说进程间通讯,大家都会想到AIDL,其实messenger和AIDL作用一样,都可以进行进程间通讯.它是基于消 ...

随机推荐

  1. shell脚本从入门到精通

    阿里云大学 shell脚本从入门到精通 第1 章 : shell脚本编程-变量-算术表达式-判断语句-if分支语句 第2 章 : case-for-While-双括号-循环嵌套-break-conti ...

  2. 数学 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 ...

  3. stack(数组模拟) POJ 2559 Largest Rectangle in a Histogram

    题目传送门 /* 题意:宽度为1,高度不等,求最大矩形面积 stack(数组模拟):对于每个a[i]有L[i],R[i]坐标位置 表示a[L[i]] < a[i] < a[R[i]] 的极 ...

  4. 题解报告:hdu 1235 统计同成绩学生人数

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1235 Problem Description 读入N名学生的成绩,将获得某一给定分数的学生人数输出. ...

  5. Lync客户端证书安装

    安装完Lync客户端后,运行时Lync客户端时,报出如下错误: [原因解析] Lync客户端没有正确安装CA证书链. [解决办法] 第一种方法:将计算机加入域. 第二种方法:不加入域的处理方法: 1. ...

  6. 【Python】高级函数

    1.Filter函数 def is_odd(x): return x % 2 == 1 #将列表中所有的奇数筛选出来 print(list(filter(is_odd,[1,2,3,4,5,6,7]) ...

  7. Android嵌入式安卓触摸屏|4418开发板平台

    核心板参数 尺寸:50mm*60mm 高度:核心板连接器为1.5mm 4418 CPU:ARM Cortex-A9 四核 S5P4418处理器 1.4GHz 6818 CPU:ARM Cortex-A ...

  8. 软件开发:速度 vs 质量

    程序开发项目进行过程中,通常会冒出这样的困惑:应该选择速度,还是选择质量?很多程序猿都会有偷懒的思维,觉得把一些摸不清头绪.不知道怎么写的代码片段去掉,可以节省很多时间,更早完成项目计划. 其实过去几 ...

  9. springboot学习笔记(二)

    首先我们来看一看,springboot启动类@RestController//@ResponseBody+@Controller@SpringBootApplicationpublic class H ...

  10. Java处理ZIP文件的解决方案——Zip4J(不解压直接通过InputStream形式读取其中的文件,解决中文乱码)

    一.JDK内置操作Zip文件其实,在JDK中已经存在操作ZIP的工具类:ZipInputStream. 基本使用: public static Map<String, String> re ...