Android Notification不显示时间

创建Notification有两种方式:

1、  Notification.Builder builder = new Notification.Builder(this);
	 Notification notification = builder.build();
2、NotificationCompat.Builder builder = new NotificationCompat.Builder( getApplicationContext(),"11");
  Notification notification = builder.build();

用第一种方式不会显示时间,第二种显示时间,上述代码是android.support环境下,androidx下面使用导入androidx的包androidx.core.app就行

发布了132 篇原创文章 · 获赞 29 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/Mr_Tony/article/details/103252769