叠加活动的另一个活动或覆盖的景色在另一个景色

2023-09-12 04:33:41 作者:于:于情于理、于成龙、成风

我有2个班,FirstActivity和SecondActivity。

I have 2 classes, FirstActivity and SecondActivity.

第一个活动

Intent intent=new Intent(getApplicationContext(),SecondActivity.class);
startActivity(intent);

是否有可能为SecondActivity可以覆盖FirstActivity? IE浏览器。 FirstActivity被调暗,SecondActivity被显示在FirstActivity之上。

Is it possible for SecondActivity to overlay on FirstActivity? ie. FirstActivity gets dimmed, SecondActivity gets displayed on top of FirstActivity.

如果这是不可能的2个不同的活动,是有可能做一个叠加了2次在同一个活动?我希望用对话是不是唯一的选择。

If it is not possible for 2 different activities, is it possible to do an overlay for 2 views in the same activity? I hope using dialog is not the only option.

推荐答案

我建议你设置你的第二个活动作为一个对话 - 这将暗淡的背景。这里是一个教程,可能会有所帮助:

I suggest you set your second activity up as a dialog -- which will dim the background. Here is a tutorial that could be helpful:

http://developer.android.com/guide/topics/ui/dialogs.html

http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application

或者你可以简单地设置主题清单作为您SecondActivity的对话框。

Or you can simply set the theme in the manifest as a dialog for your SecondActivity.