TranslucentBlurActivity
package org.wp.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
public class TranslucentBlurActivity extends Activity {
private LinearLayout myLlay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Have the system blur any windows behind this one.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
setContentView(R.layout.translucent_background);
myLlay = (LinearLayout) this.findViewById(R.id.myLlay);
myLlay.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
TranslucentBlurActivity.this.finish();
return false;
}
});
}
}
translucent_background.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/tu_stag_finger"
android:id="@+id/myLlay">
<!-- @drawable/tu_stag_finger 透明背景提示图片 -->
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wp.activity" android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TranslucentBlurActivity"
android:theme="@style/Theme.Transparent" />
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme is the default theme. -->
<style name="Theme" parent="android:Theme">
</style>
<!-- Variation on our application theme that has a transparent background;
this example completely removes the background, allowing the activity to
decide how to composite. Also here we force the translucency ourself rather
than making use of the built-in translucent theme. -->
<style name="Theme.Transparent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
<item name="android:windowBackground">@drawable/transparent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
</resources>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<drawable name="transparent_background">#00000000</drawable>
</resources>
分享到:
相关推荐
Android 半透明菜单
Android 半透明Menu 效果源码
通过对画笔的设置,获取灰色遮盖,不用美工的图片也可以达到半透明遮盖的效果,节省了资源。
在布局页面加载时根据背景变换实现模糊和半透明的效果
Android 半透明对话框Demo源码
Android 仿UC半透明菜单!
Android PopupuWindow 背景半透明,设置最大高度
Android夜间模式实现,通过在window上加一层半透明的View,解决网上坑点,亲自在项目中尝试
常用android颜色色值和半透明色值的设置
Android屏幕适配之状态栏导航栏半透明、全透明(5.0以上去阴影),方法多样
android半透明对话框实现,小demo
重载dialog,是周围出现透明磨砂的效果。点击dialog以外区域自动退出。
[Android][半透明遮罩]
Android项目实现半透明的popupwindow.rar
Android 半透明对话框Demo源码.rar
Android 半透明Menu效果源码.rar
APP初始使用,半透明引导界面
Android程序研发源码Android 半透明对话框Demo源码.rar
Android程序研发源码Android 半透明Menu效果源码.zip
Android 半透明Menu效果源码.zip源码资源下载Android 半透明Menu效果源码.zip源码资源下载