public class MainActivity extends AppCompatActivity {
private static final int NO_2 =0x2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
//按钮的点击方法
public void show(View v){
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.mipmap.guojia);
builder.setContentTitle("郭嘉");//系统限制,可能不显示
builder.setContentText("我们打袁绍吧");//系统限制,可能不显示
builder.setDefaults(Notification.DEFAULT_ALL);
//添加宽视图
NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
style.setBigContentTitle("十胜十败");
//由手机屏幕像素决定显示多少
style.addLine("第一是道胜");
style.addLine("第二是义胜");
style.addLine("第三是治胜");
style.addLine("第四是度胜");
style.addLine("第五是谋胜");
style.addLine("第六是德胜");
style.addLine("第七是仁胜");
style.addLine("第八是明胜");
style.addLine("第九是文胜");
style.addLine("第十是武胜");
style.setSummaryText("作者:郭嘉");//添加概要
builder.setStyle(style);
Notification n = builder.build();
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(NO_2, n);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有