简体   繁体   English

如何设置模糊/暗淡背景

[英]how to set Blur/dim background

I'm trying to set blur background image. 我正在尝试设置模糊背景图像。 Android studio projects are available. Android工作室项目可用。 But I'm using eclipse. 但我正在使用eclipse。 So any one help me to how to set blur image programmatically? 那么任何人都可以帮助我如何以编程方式设置模糊图像?

Use this to set your opacity 用它来设置不透明度

android:alpha="0.5"

OR 要么

 yourView.getBackground().setAlpha(100);

To set transparency level of the view to make it dim 设置视图的透明度级别以使其变暗

View class have setAlpha(float alpha) method which is Added in API level 11. View类具有setAlpha(float alpha)方法,该方法在API级别11中添加。

So from API level 11 and after you can use that method in xml and class too. 因此,从API级别11开始,您也可以在xml和类中使用该方法。

Using xml android:alpha set float value between 0 to 1 使用xml android:alpha设置浮点值介于0 to 1之间

For before and after api level 11(for all) third party library is available for alpha and other things also. 对于api 11级之前和之后(对所有人而言)第三方库也可用于alpha和其他东西。

NineOldAndroid NineOldAndroid

ViewHelper.setAlpha(View yourview,float alpha)

What else you can do to make image blure effect is, convert image to bitmap with blur/dim effect. 你还可以做些什么才能使图像模糊效果,将图像转换为具有模糊/暗淡效果的位图。 check this 检查一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM