叠加活动的另一个活动或覆盖的景色在另一个 [英] Overlay an activity on another activity OR overlay a view over another

查看:120
本文介绍了叠加活动的另一个活动或覆盖的景色在另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有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:

<一个href="http://developer.android.com/guide/topics/ui/dialogs.html">http://developer.android.com/guide/topics/ui/dialogs.html

<一个href="http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application">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.

这篇关于叠加活动的另一个活动或覆盖的景色在另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆