开发者

Android application transparency and window sizing at root level

开发者 https://www.devze.com 2022-12-14 18:08 出处:网络
Is it possible to create an application with a transparent background on the root task such that you can see the task running beneath it

Is it possible to create an application with a transparent background on the root task such that you can see the task running beneath it when it is part of a separate stack? Alternatively, is it possible to run an application so the window of the root task is only开发者_如何学Go a portion of the screen instead of the whole screen?

I understand how the transparency and window sizing is done with activities that are not the root task and this works fine. However, the root task of an activity seems to always fill the whole screen and be black even when a transparent theme is applied to the application object in the manifest file.

ApplicationManifest.xml:

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

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

Colors.xml

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


It is possible to have your application run with a transparent background. You don't even need to define your own theme all you need to so is add:

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

to the application tag in your AndroidManifest.xml. As for having your app only take up part of the screen, I'm not sure.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号