如何设置背景透明
我有一个xml文件布局,在service里面通过
mView = View.inflate( this, R.layout.match, null );
mWindowManager = ( WindowManager ) getSystemService( "window" );
获得view,然后用
mWindowManager.addView( mView, p );添加view,可是为什么add显示出来的背景不能为透明的呢?
ps:设置过#00000000无效。
无奈求助。。。。
其中p设置如下:
LayoutParams p = new LayoutParams( LayoutParams.TYPE_APPLICATION_PANEL );
p.flags = LayoutParams.FLAG_HARDWARE_ACCELERATED | LayoutParams.FLAG_NOT_FOCUSABLE;
p.token = windowToken;
p.x = x;
p.y = y;
p.width = w;
p.height = h;
p.gravity = 8388659;
布局文件如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/intro_bg"
>
<ImageView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:src="@drawable/unlock_tips" />
<TextView
android:id="@+id/unlock_tv"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:layout_marginBottom="10dp"
android:textSize="17dp"
android:text=""
android:gravity="center"
android:textColor="#ffffff"
android:layout_alignParentBottom="true"/>
</RelativeLayout>