开发者

On Android, how do I use previous Activity's screen as my new Activity's background without translucent background turning black?

开发者 https://www.devze.com 2023-03-07 04:51 出处:网络
Currently I\'m using translucent background which allo开发者_JS百科ws for the new Activity to use the previous Activity\'s screen as the background.However, if I press home and then return to the acti

Currently I'm using translucent background which allo开发者_JS百科ws for the new Activity to use the previous Activity's screen as the background. However, if I press home and then return to the activity, the translucent background becomes black. Is there a way to avoid the background from turning black?


You can use a theme to make any activity translucent.

<activity android:name=".MyActivity" android:theme="@android:style/Theme.Translucent" ..>
    ..
</activity>

This will make the background for the activity translucent also when you return to it. But obviously you can't control the background of the activity behind it.


using

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

in your activity tag in the manifest file.

0

精彩评论

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