如何在不删除先前活动的情况下在另一个活动上显示透明活动
问题描述:
如何在不删除先前活动的情况下在另一个活动上显示透明活动?
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);
希望有帮助.