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

  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. hdu 1178 Heritage from father (推导)

    题意: 有一个金币堆的金字塔,最上层就有一个金币,以后的i层都是边长为i的实心三角形,给你层数,问:一共有多少个金币?(用科学计数法表示,并且保留两位小数) 解题思路: 根据题意可知求出1*n+2*( ...

  2. 模拟+贪心 SCU 4445 Right turn

    题目传送门 /* 题意:从原点出发,四个方向,碰到一个点向右转,问多少次才能走出,若不能输出-1 模拟:碰到的点横坐标相等或纵坐标相等,然而要先满足碰到点最近, 当没有转向或走到之前走过的点结束循环. ...

  3. 225 Implement Stack using Queues 队列实现栈

    Implement the following operations of a stack using queues. push(x) -- Push element x onto stack.pop ...

  4. 204 Count Primes 计数质数

    计算所有小于非负整数 n 的质数数量. 详见:https://leetcode.com/problems/count-primes/description/ Java实现: 埃拉托斯特尼筛法:从2开始 ...

  5. MVP架构模式

    概念解释 MVP是Model(数据) View(界面) Presenter(表现层)的缩写,它是MVC架构的变种,强调Model和View的最大化解耦和单一职责原则 Model:负责数据的来源和封装, ...

  6. [转]在ASP.NET MVC3中使用EFCodeFirst 1.0

    本文转自:http://kb.cnblogs.com/page/97003/ 作者: NinoFocus  来源: 博客园  发布时间: 2011-04-12 10:41  阅读: 11971 次   ...

  7. zTree树形控件讲解

    由于截图时间距离有些长,找不到原文出处,如有侵权请联系删除.

  8. java websocket 简单使用【案例】

    现很多网站为了实现即时通讯,所用的技术都是轮询(polling).轮询是在特定的的时间间隔(如每1秒),由浏览器对服务器发 出HTTP request,然后由服务器返回最新的数据给客服端的浏览器.这种 ...

  9. Python学习 Day 4 函数 切片 迭代 列表生成式 生成器

    定义函数 def my_abs(x):#求绝对值的my_abs函数 if x >= 0: return x else: return –x def nop():#空函数 pass#占位符 参数检 ...

  10. 一台机器运行多个JBoss多实例

    JBossXMLJVMTomcat应用服务器  我们经常会遇到这种情况,有时候希望在同一台机器上部署若干个JBoss实例,上面运行不同的应用程序,这样的话无论由于什么原因需要对某个JBoss实例进行关 ...