CameraKit / blurkit-android

The missing Android blurring library. Fast blur-behind layout that parallels iOS.
MIT License
3.72k stars 309 forks source link

Doesn't work for my custom AppToolBar #44

Closed dush1729 closed 5 years ago

dush1729 commented 5 years ago

BlurKit doesn't work for my custom AppToolBar. It shows black background by default. But if I change blk_downscaleFactor then it works almost perfectely(there's is extra black at the bottom of toolbar). My android version is 8.1.0 on Redmi Note 5 pro.

Downscale factor = 0.12 downscalefactor 0 12

Downscale factor = 0.66 downscalefactor 0 66

Downscale factor = 1 downscalefactor 1

One more point. I also have an Android Box having android version 7.1.2. And it works fine there with all settings.

emersoncloud commented 5 years ago

@dush1729 Do you have a screenshot of the desired effect working properly? As well as your Layout file if you can so I can get a better idea of how you're using BlurLayout. Thanks!

dush1729 commented 5 years ago

Desired effect is to blur the background of Toolbar. As of now, it is opaque. Attaching current app toolbar view

img_20181103_033510

Layout file structure is llike this

Linear Layout
 Icon
 Relative Layout
  Custom View for text display
  Custom View for text display
  Linear layout
 Icon

What I did was changed Linear layout to Constraint layout and added BlurkIt just inside it before everything. Ofcourse I had to change display properties of my new Constraint Layout because initially it was in Linear layout. New layout

Constraint Layout
 Blurkit
 Icon
 Relative Layout
  Custom View for text display
  Custom View for text display
  Linear layout
 Icon

Instead of above approach I also tried creating a new Constraint Layout and using Blurkit and Linear Layout inside it. In this, I could see the blur but without any content. Maybe because Linear layout is overriding the background? New layout:

Constraint Layout
 BlurKit
 Linear Layout
  Icon
  Relative Layout
   Custom View for text display
   Custom View for text display
   Linear layout
  Icon

img_20181103_033528

dush1729 commented 5 years ago

@emersoncloud How can I use BlutKit on View(I saw how to do it for image in this video)? I tried to do it using Bitmap and Canvas but it crashed.

dush1729 commented 5 years ago

Fixed it by removing one of the parent element of AppToolbar.