0

I made a Style/Theme which fully transparents my layout.Now I want to Blur the background.The most solutions I founded are for two Views.So the second layout blurs the first out.But thats NOT what I want.I just want to blur the background which is seeable (For example android luncher menu or homescreen etc.).

My Style:

<style name="Theme.Transparent" parent="@android:style/Theme.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>

I used this on my application in manifest. Some one got an idea ?

EDIT:

Now I wanted to take a screenshot so I can blur the image after that.this should propably screen the android luncher, homescreen whatever .I used this code and it is throwsing a null object

public Bitmap screenshot_menu()
            {
                RelativeLayout r1;

                r1 = (RelativeLayout)findViewById(R.id.relativeLayout_MAIN);
                View v1 = r1.getRootView();
                v1.setDrawingCacheEnabled(true);
                Bitmap bm = v1.getDrawingCache();


                return bm;
            } 

Is it because of my theme ? Or what could be wrong here ?

  • Can you get the homescreen background as a bitmap? (probably?) If so, you can blur the bitmap and set it as your background. – Ael Jun 12 '15 at 09:01
  • hmm but Ive got a Splashscreen before my main activity starts. Is it not screenshoting it then ? And which class can you suggest ? (I read that there are classes which are very slow) – Chuck Norriz Jun 12 '15 at 09:08
  • I'm using this function to blur backgrounds at the moment and haven't noticed any delay: http://stackoverflow.com/a/10028267/1221721 example: `mybitmap = fastblur(mybitmap, 137);` – Ael Jun 12 '15 at 09:20
  • Youve also got a function screenshot without the upper bar ? (where the percentage of battery stands and clock etc). I only need the main part. – Chuck Norriz Jun 12 '15 at 09:44

1 Answers1

0

I don't know wheather it will match your needs but you can also use FrameLayout and set a semi transparent image at the top other components so that if you make it visible the whole layout seems blured below it:

    <FrameLayout
     android:layout_width="match_parent"
    android:layout_height="match_parent"
     >
    <ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     android:src="@drawable/some_semi_tansparentimage"
    >
    <\ImageView>
    <OtherElements1>
    <OtherElements2>
    <OtherElements3>

    <\FrameLayout>

just alter the visibility of ImageView to add ro remove blured ness

NavinRaj Pandey
  • 1,674
  • 2
  • 26
  • 40