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. File文件存储

    文件存储的核心是Context提供了一个openFileOutput()与openFileInput()俩个方法 课程demo public class MainActivity extends Ap ...

  2. 分享div、text、Box Shadow(阴影)演示及代码的页面

    附图: 直接上链接:www.css88.com/tool/css3Preview/Box-Shadow.html

  3. iOS Programming Controlling Animations 动画

    iOS Programming Controlling Animations 动画 The word "animation" is derived from a Latin wor ...

  4. iOS Programming Auto Layout: Programmatic Constraints 自动布局:通过编程限制

    iOS Programming  Auto Layout: Programmatic Constraints  1.  However, if your views are created in co ...

  5. IDEA安装使用

    下载地址: https://www.jetbrains.com/idea/download/previous.html 这里我下载的是:2016.3.8版本的 安装: 安装成功后,需要秘钥的话,在 h ...

  6. 源代码管理SVN的使用

    SVN 全称是Subversion,集中式版本控制之王者 SVN 版本控制,需要自己搭建一个管理代码的服务器,提供开发人员,上传和下载 1.基本介绍 使用环境 要想利用SVN管理源代码,必须得有2套环 ...

  7. java web 学习笔记 - JSP标签编程

    1.JSP标签编程简介 标签编程在开发中并不常见,主要是为了更好的理解struts等框架的标签而打基础,完善相关知识体系. 标签编程分为: 一个继承自TagSupport的标签类,一个在WEB-INF ...

  8. PHP常量和数据类型考察点

    PHP 常量 常量是单个值的标识符(名称).在脚本中无法改变该值. 有效的常量名以字符或下划线开头(常量名称前面没有 $ 符号). 注释:与变量不同,常量贯穿整个脚本是自动全局的. PHP常量的两种定 ...

  9. Day3 CSS 引入及基本选择器

    一 .CSS 层叠样式表,为了使网页元素的样式更加丰富,内容与样式拆分开来.HTML负责结构与内容,表现形式交给CSS. CSS注释/**/ 来注释 二.CSS基本语法与引用 CSS的语法结构 选择器 ...

  10. CSS3 radio 或checkbox 自定义 样式

    .style-radio {position:relative;width:15px;height:15px;outline:none;} .style-radio:after {position:a ...