如何在不删除先前活动的情况下在另一个活动上显示透明活动 [英] How to display transparent activity on the another activity without removing previous activity

查看:98
本文介绍了如何在不删除先前活动的情况下在另一个活动上显示透明活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不删除先前活动的情况下在另一个活动上显示透明活动?

How to display transparent activity on the another activity without removing previous activity ?

我能够创建透明活动,但是当我尝试使用intent推送它时,先前的活动将被删除.我希望我的透明活动位于上一个活动的顶部.

I am able to create transparent activity but when i trying to push it using intent , the previous activity gets removed. I want my transparent activity on the top of previous activity.

谢谢!

推荐答案

在清单中声明您的活动

 <activity android:name=".yourActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>

并为您的布局添加透明背景 像这样

and add a transperent background to your layout like this

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
  android:background = "any tranparent image name"  >
 </RelativeLayout>

我认为您正在使用它来打开透明活动,从而完成上一个活动

i think you are using this to open your transparent activity it finish your previous activity

Intent intent =new Intent(mContext,yourNewActivity.class);
startActivity(intent);
finish();

从此处删除完成,然后将您的新活动移到之前的活动顶部

remove finish from here then your new activity in on top of previous activity like this

 Intent intent =new Intent(mContext,yourNewActivity.class);
 startActivity(intent);

希望有帮助.

这篇关于如何在不删除先前活动的情况下在另一个活动上显示透明活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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