使线性布局半透明和模糊
所以我想做的是为线性布局创建半透明且模糊的背景。
现在我有一个完全黑色的线性布局,覆盖了一些必须购买密钥才能显示的信息,但是我希望它被模糊,而不是完全覆盖,因为它破坏了布局,它需要留在那里,只是模糊且难以辨认。
感谢您的帮助!
So what I'm trying to do is create a translucent and blurry background to a linear layout.
Right now I have a linear layout thats completely black covering up some information that a key must be purchased to show, however I would like it to be blurred out, not completely covered as it ruins the layout, it needs to stay there, just blurry and illegible.
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定 Linearlayout 。但对于您的活动,您可以尝试这个。
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
并使用 setContentView(R.layout.your_layout); 方法
I'm not sure for Linearlayout. But for your activity you can try this.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
and use the
setContentView(R.layout.your_layout);
method如果您想让任何视图背景半透明,请使用下面的代码,
它适用于 EditText。而且据我所知,它应该适用于任何视图。所以一旦尝试一下这个
If you want to make any View Background translucent then use below code
it work me for EditText. And AFAIK it should work for any view.So once try for this one
尝试 GLSurfaceView 怎么样:
http://developer.android.com/resources/articles/glsurfaceview .html
在 Android SDK 中,有一个获取半透明表面的示例 (app/TranslucentActivity.java),主要是设置 Alpha 通道:
有关使用 Alpha 通道的其他线程,请参阅:
Alpha 通道模糊
如何模糊和调暗图像以用作活动背景?
在 android 上模糊图像
另一个例子是 app/TranslucentBlurActivity.java (来自 Android SDK):
How about trying GLSurfaceView:
http://developer.android.com/resources/articles/glsurfaceview.html
Within Android SDK there is an example on getting translucent surface (app/TranslucentActivity.java), essentially setting the alpha channel:
For other threads on using Alpha channel refer to:
Alpha Channel Blur
How can I blur and dim an image to be used as an activity background?
blur a image at android
Another example is the app/TranslucentBlurActivity.java (from Android SDK):