Android Viewbadger 实现消息数字提示
开源组件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(); } }
显示效果:
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。