所以我想要做的是创建一个线性布局的半透明和模糊的背景。使线性布局半透明和模糊
现在我有一个线性布局,完全黑色掩盖了一些信息,必须购买钥匙才能显示,但是我希望它被模糊,没有完全覆盖,因为它会破坏布局,它需要停留那里,只是模糊和难以辨认。
感谢您的帮助!
所以我想要做的是创建一个线性布局的半透明和模糊的背景。使线性布局半透明和模糊
现在我有一个线性布局,完全黑色掩盖了一些信息,必须购买钥匙才能显示,但是我希望它被模糊,没有完全覆盖,因为它会破坏布局,它需要停留那里,只是模糊和难以辨认。
感谢您的帮助!
我不确定Linearlayout。但对于你的活动,你可以试试这个。
getWindow()。setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
,并使用setContentView(R.layout.your_layout);
方法
如果你想查看的任何背景半透明然后用下面的代码
android:background="@null"
它的工作我的EditText。而且据我所知,应该对任何view.So工作,一旦尝试了这一个
半透明!=透明 – Graham
如何试图GLSurfaceView:
http://developer.android.com/resources/articles/glsurfaceview.html
在Android SDK中有在得到透光面(应用程序/ TranslucentActivity.java为例),基本上设置alpha通道:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create our Preview view and set it as the content of our
// Activity
mGLSurfaceView = new GLSurfaceView(this);
// We want an 8888 pixel format because that's required for
// a translucent window.
// And we want a depth buffer.
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
// Tell the cube renderer that we want to render a translucent version
// of the cube:
mGLSurfaceView.setRenderer(new CubeRenderer(true));
// Use a surface format with an Alpha channel:
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
setContentView(mGLSurfaceView);
}
对于其他线程使用Alpha通道是指:
How can I blur and dim an image to be used as an activity background?
另一个例子是应用程序/ TranslucentBlurActivity.java(从Android SDK中):
public class TranslucentBlurActivity extends Activity {
/**
* Initialization of the Activity after it is first created. Must at least
* call {@link android.app.Activity#setContentView setContentView()} to
* describe what is to be displayed in the screen.
*/
@Override
protected void onCreate(Bundle icicle) {
// Be sure to call the super class.
super.onCreate(icicle);
// Have the system blur any windows behind this one.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
// See assets/res/any/layout/translucent_background.xml for this
// view layout definition, which is being set here as
// the content of our screen.
setContentView(R.layout.translucent_background);
}
}
在第二个示例中,已弃用标志“FLAG_BLUR_BEHIND”。 – Ayoub
我不知道,没有ü尝试把这个在Manifest中添加标签? android:theme =“@ android:style/Theme.Dialog” –