Android Question ACToolBar shadow lost with background change

npsonic

Active Member
Licensed User
Title says it all, if I add image into ACToolBar background the shadow will be lost.
Image size doesn't matter. ACToolBar just seems to losing its properties like elevation after background change.
Has anyone found any solution for this? Changing elevation after background change doesn't do anything.
 
Didn't find any good solutions, so here is what I end up with.

Code: Copy
Sub CreateShadow (base As View, elevation As Int)
    Dim c As Canvas
    c.Initialize(base)
    
    Dim shadow As GradientDrawable
    Dim clrs(2) As Int
    clrs(0) = Colors.Gray
    clrs(1) = Colors.White
    shadow.Initialize("TOP_BOTTOM", clrs)
        
    Dim destRect As Rect
    destRect.Initialize(0, base.Height - elevation, base.Width, base.Height)
    c.DrawDrawable(shadow,destRect)
End Sub
 
Upvote 0
Is there any better solution for shadow problem? Earlier CreateShadow method works, but it just doesn't look like a real shadow.

The main problem is that if I set bitmap to background of actionbar the shadow will disappear.
 
Upvote 0
Problem was that the ACToolBar lost it's elevation after I set some bitmap to it's background and after that elevation couldn't be set again.

I didn't realize that I can put ACToolBar inside an panel. That solved a problem.
 
Upvote 0
Back
Top