Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set Blur/dim background

Tags:

android

I'm trying to set blur background image. Android studio projects are available. But I'm using eclipse. So any one help me to how to set blur image programmatically?

like image 370
Ajith Avatar asked Feb 02 '15 05:02

Ajith


2 Answers

Use this to set your opacity

android:alpha="0.5"

OR

 yourView.getBackground().setAlpha(100);
like image 83
Syed Raza Mehdi Avatar answered Sep 28 '22 18:09

Syed Raza Mehdi


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.

So from API level 11 and after you can use that method in xml and class too.

Using xml android:alpha set float value between 0 to 1

For before and after api level 11(for all) third party library is available for alpha and other things also.

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

like image 38
user1140237 Avatar answered Sep 28 '22 19:09

user1140237