gpt4 book ai didi

java - 根级别的 Android 应用程序透明度和窗口大小

转载 作者:行者123 更新时间:2023-11-30 12:00:28 27 4
gpt4 key购买 nike

是否可以创建具有透明背景的应用程序在根任务上,这样您就可以看到在它下面运行的任务什么时候它是单独堆栈的一部分?或者,是否可以运行一个应用程序,所以根任务的窗口只是一部分屏幕而不是整个屏幕?

我了解透明度和窗口大小是如何完成的不是根任务的 Activity ,这很好用。然而,一个 Activity 的根任务似乎总是填满整个屏幕即使将透明主题应用于应用程序也是黑色的 list 文件中的对象。

应用程序 list .xml:

<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true"
android:theme="@style/Theme.Transparent">

样式.xml

<resources>
<style name="Theme.Transparent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@drawable/
transparent_background</item>
<item name="android:windowAnimationStyle">@android:style/
Animation.Translucent</item>
<item name="android:colorForeground">#fff</item>
<item name="android:windowIsFloating">true</item>
<item name="android:gravity">bottom</item>
</style>
</resources>

颜色.xml

<resources>
<drawable name="transparent_background">#00000000</drawable>
</resources>

最佳答案

您的应用程序可以在透明背景下运行。您甚至不需要定义自己的主题,只需添加:

android:theme="@android:style/Theme.Translucent"

到您的 AndroidManifest.xml 中的应用程序标记。至于让您的应用仅占据屏幕的一部分,我不确定。

关于java - 根级别的 Android 应用程序透明度和窗口大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1941653/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com