patrickfav / Dali

Dali is an image blur library for Android. It contains several modules for static blurring, live blurring and animations.
https://favr.dev/opensource/dali
Apache License 2.0
1.05k stars 89 forks source link

How to blur view with transparent background #13

Closed jackyhieu1211-hn closed 5 years ago

jackyhieu1211-hn commented 5 years ago

Hello admin

I use background is image not transparent. Library worked good. But I use background is transparent (#66000000) or background is image have background is #66000000 or image only have a color (#000000). Library not work. Please help me. thank you very much

   <androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/pageControlProduct"
    android:layout_width="match_parent"
    android:layout_height="@dimen/video_controller_height"
    android:layout_gravity="bottom"
  >

  <androidx.appcompat.widget.AppCompatImageView
        android:id="@+id/viewBlur"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="#66000000" // or @drawable/background_product (#66000000)
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
   />
  </androidx.constraintlayout.widget.ConstraintLayout>

and use

  Dali.create(this).load(pageControlProduct).blurRadius(20)
    .downScale(2).concurrent().reScale().skipCache().into(viewBlur);

or

 Dali.create(this).load(R.drawable.background_product).blurRadius(25).into(viewBlur)
patrickfav commented 5 years ago

Could you please post a screenshot of your app, and what you expect it to look like?