Blur the background of Layout

1k views Asked by At

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 ?

1

There are 1 answers

0
NavinRaj Pandey On

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