【问题标题】:Running a layout in foreground在前台运行布局
【发布时间】:2023-03-19 22:06:02
【问题描述】:

我可以通过滑动手势在设备处理的前台运行相对或线性布局吗?我有这个前台服务代码,但它只有一个通知作为例子,我还没有在网上找到使用布局的东西。代码如下:

Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
        System.currentTimeMillis());
Intent notificationIntent = new Intent(this, ExampleActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(this, getText(R.string.notification_title),
        getText(R.string.notification_message), pendingIntent);
startForeground(ONGOING_NOTIFICATION_ID, notification);

【问题讨论】:

标签: android android-service foreground


【解决方案1】:

您所要做的就是创建带有透明窗口的 Activity。这里给出了一个很好的例子:How do I create a transparent Activity on Android?

因此,当它启动时,它会出现在每个应用程序上方,您可以实现所需的每个布局。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    • 2021-07-04
    • 2014-08-25
    相关资源
    最近更新 更多