Android仿Iphone通知角标的实现
来源:互联网 发布:json测试工具 编辑:程序博客网 时间:2024/06/07 16:06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package
cc.testtipmessage2;
import
com.readystatesoftware.viewbadger.BadgeView;
import
android.os.Bundle;
import
android.widget.ImageView;
import
android.app.Activity;
import
android.graphics.Color;
/**
* Demo描述:
* 仿Iphone通知角标的实现,借以提示用户有几条新的信息
*
* 参考资料:
*https://github.com/jgilfelt/android-viewbadger
*http://blog.csdn.net/t12x3456/article/details/9337555
* Thank you very much
*/
public
class
MainActivity
extends
Activity {
private
ImageView mImageView;
@Override
protected
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
setContentView(R.layout.main);
init();
}
private
void
init(){
mImageView=(ImageView) findViewById(R.id.imageView);
BadgeView badgeView =
new
BadgeView(MainActivity.
this
, mImageView);
badgeView.setText(
"5"
);
badgeView.setTextSize(
8
.5f);
badgeView.setTextColor(Color.DKGRAY);
badgeView.show();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<
RelativeLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
xmlns:tools
=
"http://schemas.android.com/tools"
android:layout_width
=
"match_parent"
android:layout_height
=
"match_parent"
>
<
ImageView
android:id
=
"@+id/imageView"
android:layout_width
=
"100dip"
android:layout_height
=
"100dip"
android:background
=
"@drawable/ic_launcher"
android:layout_centerInParent
=
"true"
/>
</
RelativeLayout
>
0 0
- Android仿Iphone通知角标的实现
- Android仿Iphone通知角标的实现(二)
- Android仿Iphone通知角标的实现(一)
- android 仿iphone tab实现
- Android角标的实现 ,各品牌手机
- Android中ListView圆角实现,仿iPhone中UITableView
- Android 实现仿iphone下拉刷新列表
- Android 实现不同Launcher 桌面角标的坑(Badge)
- iPhone实现本地通知
- iPhone实现本地通知
- Android 仿闹钟 及 通知栏的实现
- Android仿iPhone圆角边框
- android实现 仿iphoneDialog实现类似于iphone对话框样式
- android仿iphone开关
- Android 仿IPhone 对话框
- android 仿IPhone ExpandableListView
- android仿iPhone滚轮控件实现及源码分析
- android仿iPhone滚轮控件实现及源码分析
- AngularJs开发实践第一天(1)
- 《用Python玩转数据》第2周学习笔记(Part1)
- jQuery实现页面详情展开收起
- Log4j.properties文件配置详解及模板
- SVN 多项目配置 (shell 一键配置)
- Android仿Iphone通知角标的实现
- Android:详情界面左右滑动看更多,ViewPager动态添加Fragment,仿51job详情界面
- #Hostapd之main函数(2)
- 2015 Objective-C 新特性
- 理解RESTful架构
- Service和Thread,写的很好
- 如何在eclipse jee中创建Maven project并且转换为Dynamic web project
- ubuntu 14.04 chrome 的 flash 插件 安装
- 在wordpress上制作一款插件