码迷,mamicode.com
首页 > 移动开发 > 详细

Android Viewbadger 实现消息数字提示

时间:2015-01-09 17:23:55      阅读:322      评论:0      收藏:0      [点我收藏+]

标签:

开源组件viewbadger实现消息数字提示,项目地址:https://github.com/jgilfelt/android-viewbadger  (可获得源码)!

Author: Jeff Gilfelt

The code in this project is licensed under the Apache Software License 2.0. 
Copyright (c) 2011 readyState Software Ltd.


技术分享


当然,这里直接是一个jar包,导入就可使用:android-viewbadger.jar(Demo中有jar包)

技术分享

实例Demo:

MainActivity.java:

package sn.qdj.viewbadgerdemo;

import com.readystatesoftware.viewbadger.BadgeView;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        View btn = findViewById(R.id.button1);
        BadgeView badge = new BadgeView(this, btn);

        badge.setTextSize(12);
        /**
         * 右上角(默认值)
         */
        badge.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); 
        badge.setText("10");
        badge.show();
    }
}
显示效果:

技术分享

Demo源码下载,请点击这里!


Android Viewbadger 实现消息数字提示

标签:

原文地址:http://blog.csdn.net/qingdujun/article/details/42556535

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!