Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在通知区添加按钮?_Android_Android Layout - Fatal编程技术网

Android 如何在通知区添加按钮?

Android 如何在通知区添加按钮?,android,android-layout,Android,Android Layout,有没有办法在通知区添加一个按钮?我想在通知区域添加一个按钮。单击该按钮,将启动特定的应用程序。因此,基本上,该按钮的行为类似于应用程序快捷方式。 我已经看到了,但没有任何帮助。您可以使用PendingDent进行上述工作,它有许多可选内容,可以添加到基本通知格式中 还可以看看这个您必须使用 您还应指定在Pending帐篷中开始的活动: PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, n

有没有办法在通知区添加一个按钮?我想在通知区域添加一个按钮。单击该按钮,将启动特定的应用程序。因此,基本上,该按钮的行为类似于应用程序快捷方式。
我已经看到了,但没有任何帮助。

您可以使用PendingDent进行上述工作,它有许多可选内容,可以添加到基本通知格式中

还可以看看这个

您必须使用

您还应指定在Pending帐篷中开始的活动:

    PendingIntent pendingIntent = PendingIntent.getActivity(context,
    0,
    new Intent(context, ActivityToStart.class),
    PendingIntent.FLAG_UPDATE_CURRENT));

另外,请看一下这一部分的基础知识:

我猜您正在寻找
TileService
以在通知面板(快速通知)区域中添加快捷方式/互动程序。由于我的大多数谷歌搜索结果都是关于如何在应用程序通知中添加操作的,所以我决定在这里写一个答案

你可以参考这里的官方参考资料