【问题标题】:Android application transparency and window sizing at root levelAndroid 应用程序透明度和根级别的窗口大小
【发布时间】:2023-03-05 03:45:01
【问题描述】:

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

我了解透明度和窗口大小是如何完成的 不是根任务的活动,这工作正常。然而, 一个活动的根任务似乎总是填满整个屏幕并且 即使将透明主题应用于应用程序也是黑色的 清单文件中的对象。

ApplicationManifest.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>

【问题讨论】:

    标签: java android


    【解决方案1】:

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

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

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

    【讨论】:

    猜你喜欢
    • 2015-05-02
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多