小编Pun*_*mar的帖子

如何制作可扩展卡?

我是 flutter 的新手,我想列出这样的卡片。

在此处输入图片说明

我试图了解原始项目,但我无法弄清楚。

我只想制作一张没有背景gif/视频效果的可扩展卡片

谢谢...

listview flutter

17
推荐指数
2
解决办法
2万
查看次数

通知未在Android 9中显示

我正在使用此代码在我的android应用程序中显示通知。这在所有android版本中都可以正常工作,但是在Android 9中没有任何通知显示。

我试图用不同的方法来实现这一点,但没有任何效果。

    public void showNotification(String heading, String description, String imageUrl, Intent intent){
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    createChannel();
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);
    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,"channelID")
            .setSmallIcon(R.drawable.logo)
            .setContentTitle(heading)
            .setContentText(description)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    int notificationId = (int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE);
    notificationManager.notify(notificationId, notificationBuilder.build());
}

public void createChannel(){
    if (Build.VERSION.SDK_INT < 26) {
        return;
    }
    NotificationManager notificationManager =
            (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
    NotificationChannel channel = new NotificationChannel("channelID","name", NotificationManager.IMPORTANCE_DEFAULT); …
Run Code Online (Sandbox Code Playgroud)

android-notifications android-9.0-pie

6
推荐指数
1
解决办法
2584
查看次数