0% found this document useful (0 votes)
2K views4 pages

How To Set Blur or Dim Background - Stack Overflow PDF

This question asks how to set a blurred background image programmatically in Android without using Android Studio. The top response recommends using the setAlpha method on a view to set transparency from API 11 onward, or using a third party library like NineOldAndroid. It also notes that converting the image to a blurred bitmap first would allow setting it as the background. The second response provides additional context that setAlpha won't work below API 11, and recommends a Google link for alternative approaches.

Uploaded by

Shoaib Quraishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views4 pages

How To Set Blur or Dim Background - Stack Overflow PDF

This question asks how to set a blurred background image programmatically in Android without using Android Studio. The top response recommends using the setAlpha method on a view to set transparency from API 11 onward, or using a third party library like NineOldAndroid. It also notes that converting the image to a blurred bitmap first would allow setting it as the background. The second response provides additional context that setAlpha won't work below API 11, and recommends a Google link for alternative approaches.

Uploaded by

Shoaib Quraishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

sign up

Stack Overflow

log in

Questions Tags Users Badges Unanswered Ask

Read this post in our app!

how to set Blur/dim background


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?
Thanks in advance.

share

improve this question


Ajith
41 1 9

Asked
Feb 2 '15 at 5:31

Sergey Brunov
6,624 1 21 48

Edited
Feb 2 '15 at 5:42

hope it helps stackoverflow.com/questions/22406961/ Syed Raza Mehdi Feb 2 '15 at 5:34


stackoverflow.com/questions/3221488/ Yvette Feb 2 '15 at 5:42
add a comment

2 Answers

Order By

use this to set your opacity


android:alpha="0.5"

Votes

or
yourView.getBackground().setAlpha(100);

share

improve this answer


Syed Raza Mehdi
1,885 1 11 33

Answered
Feb 2 '15 at 5:33

i am glad it helped :) Syed Raza Mehdi Feb 2 '15 at 5:53


@sayed for below API 11 it won't work ... check goo.gl/dJGC20 user1140237 Feb 2 '15 at 5:53
possible to set image like gaussian blur? Ajith Feb 3 '15 at 8:49
see this if it might be of any help stackoverflow.com/questions/2067955/ Syed Raza Mehdi Feb 3 '15 at 9:25
add a comment

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

share

improve this answer

user1140237
2,706 16 33

Answered
Feb 2 '15 at 5:48

Your Answer

log in
or

Name

Email

By posting your answer, you agree to the privacy policy and terms of service.

meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app

Post Your Answer

2016 Stack Exchange, Inc

You might also like