首先设定该activity的theme如下
android:theme="@android:style/Theme.Translucent.NoTitleBar"
此时该activity由android系统处理为透明色的
为了使activity有一定的半透明效果,可以在activity的xml布局文件中中加一个属性
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000" >
其中#80为背景的透明度,可以根据喜好来进行设置,下图是实现的效果