how to dim the current activity?

妖精的绣舞 提交于 2019-12-22 23:57:05

问题


Is there a way to dim the Current activity when calling the new activity? as in the new activity should be above the previous activity. The new activity that i have is a gallery. It comes when the finish button in the previous activity is clicked. So i want this gallery to be placed above the previous activity


回答1:


Try setting the background of your gallery Activity to a transparent color. You might need to create a custom theme and more details can be found here: http://developer.android.com/guide/topics/ui/themes.html

This is probably going to be completely transparent, so not quite what you want. But, for example:

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



回答2:


I doubt if you could overlay two activities on top of each other. However, in order to achieve the effect that you mentioned, you could use a customized dialog to popup within your main gallery activity, and then set the rest of the screen as blurred, with the use of window manager. For an example of this, you can see: http://www.stealthcopter.com/blog/2010/01/android-blurring-and-dimming-background-windows-from-dialogs/



来源:https://stackoverflow.com/questions/7132265/how-to-dim-the-current-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!