wasabeef / Blurry

Blurry is an easy blur library for Android
Apache License 2.0
5.57k stars 602 forks source link

How to blur a picture from one RelativeLayout and put it onto another #65

Open kevinkokomani opened 6 years ago

kevinkokomani commented 6 years ago

Hi, I've got basically two major layouts in one screen. The bottom one has a picture set as its background that, upon opening the activity, I would like to blur and then display that blurred picture on the top one. The reason I can't just blur the picture and put it at the top is because the picture at the bottom is going to change periodically and I'd like the new picture to be then blurred and put on top when it changes and set as the background of that layout. Is there any way to accomplish this with this library?

//top RelativeLayout - would like to take albumArtBackground from bottom RelativeLayout 
//and blur it and set it as the background here
<RelativeLayout
        android:id="@+id/layout"
        android:paddingBottom="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true">
...
</RelativeLayout>

//bottom RelativeLayout
<RelativeLayout
        android:layout_below="@+id/layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <AutoCompleteTextView
            .../>

        <ImageView
            ... />

//would like to take albumArtBackground and put it on top RelativeLayout
        <ImageView
            android:id="@+id/albumArtBackground"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/albumart"
            android:scaleType="centerCrop"
            style="@style/BackgroundImageView"
            android:layout_alignParentTop="true"
            android:layout_alignParentStart="true" />

    </RelativeLayout>