Android BGABadgeView:BGABadgeFrameLayout(5)

简介: Android BGABadgeView:BGABadgeFrameLayout(5)BGABadgeView除了有自己的线性布局,相对布局外(见附录文章7,8),还实现了FrameLayout。


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开发
Android BGABadgeView:显示提示数字(2)
 Android BGABadgeView:显示提示数字(2) 在附录文章3的基础上,对代码进行稍微改造,显示在红色小圆球内部显示数字,同时给红色小圆球通过可编程调控红色小圆球的整体外观,布局文件和附录文章3类似。
1006 0
|
Android开发
Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3)
 Android BGABadgeView:BGABadgeLinearLayout以整体线性布局作为BadgeView(3) Android BGABadgeView不仅可以把某个View作为Badge,也可以把一个完整的线性布局作为BadgeView。
1078 0
|
Android开发
Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4)
 Android BGABadgeView:BGABadgeImageView以及BGABadgeRelativeLayout(4) 在附录文章5,6,7的基础上,写一个小例子说明BGABadgeImageView以及BGABadgeRelativeLayout。
1167 0
|
Android开发
Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1)
 Android BGABadgeView:新消息/未接来电/未读消息/新通知圆球红点提示(1) 现在很多的APP会有新消息/未接来电/未读消息/新通知圆球红点提示,典型的以微信、QQ新消息提示为例,当微信朋友圈有新的朋友更新/发布朋友圈消息后,在微信的底部切换卡上会有一个红色的小圆球红点,表示有新消息,提示用户查看。
1336 0
|
17天前
|
开发工具 Android开发
X Android SDK file not found: adb.安卓开发常见问题-Android SDK 缺少 `adb`(Android Debug Bridge)-优雅草卓伊凡
X Android SDK file not found: adb.安卓开发常见问题-Android SDK 缺少 `adb`(Android Debug Bridge)-优雅草卓伊凡
222 11
X Android SDK file not found: adb.安卓开发常见问题-Android SDK 缺少 `adb`(Android Debug Bridge)-优雅草卓伊凡
|
27天前
|
Java 开发工具 Maven
【01】完整的安卓二次商业实战-详细的初级步骤同步项目和gradle配置以及开发思路-优雅草伊凡
【01】完整的安卓二次商业实战-详细的初级步骤同步项目和gradle配置以及开发思路-优雅草伊凡
99 6
|
3月前
|
安全 数据库 Android开发
在Android开发中实现两个Intent跳转及数据交换的方法
总结上述内容,在Android开发中,Intent不仅是活动跳转的桥梁,也是两个活动之间进行数据交换的媒介。运用Intent传递数据时需注意数据类型、传输大小限制以及安全性问题的处理,以确保应用的健壯性和安全性。
191 11
|
3月前
|
移动开发 Java 编译器
Kotlin与Jetpack Compose:Android开发生态的演进与架构思考
本文从资深Android工程师视角深入分析Kotlin与Jetpack Compose在Android系统中的技术定位。Kotlin通过空安全、协程等特性解决了Java在移动开发中的痛点,成为Android官方首选语言。Jetpack Compose则引入声明式UI范式,通过重组机制实现高效UI更新。两者结合不仅提升开发效率,更为跨平台战略和现代架构模式提供技术基础,代表了Android开发生态的根本性演进。
116 0
|
7月前
|
JavaScript Linux 网络安全
Termux安卓终端美化与开发实战:从下载到插件优化,小白也能玩转Linux
Termux是一款安卓平台上的开源终端模拟器,支持apt包管理、SSH连接及Python/Node.js/C++开发环境搭建,被誉为“手机上的Linux系统”。其特点包括零ROOT权限、跨平台开发和强大扩展性。本文详细介绍其安装准备、基础与高级环境配置、必备插件推荐、常见问题解决方法以及延伸学习资源,帮助用户充分利用Termux进行开发与学习。适用于Android 7+设备,原创内容转载请注明来源。
1417 77
|
4月前
|
安全 Java Android开发
为什么大厂要求安卓开发者掌握Kotlin和Jetpack?深度解析现代Android开发生态优雅草卓伊凡
为什么大厂要求安卓开发者掌握Kotlin和Jetpack?深度解析现代Android开发生态优雅草卓伊凡
191 0
为什么大厂要求安卓开发者掌握Kotlin和Jetpack?深度解析现代Android开发生态优雅草卓伊凡

热门文章

最新文章