Andrey Novikov
Andrey Novikov

Reputation: 5593

DecorView not drawing over SurfaceView

I have an application that uses SurfaceView do draw content. I wanted to add nice ShowcaseView library to my application which uses getWindow().getDecorView()).addView(...) to draw itself on top of other views and decorations. But in my case it does not draw over my SurfaceView (if I remove it from layout, everything works perfect).

Is it a limitation of Android architecture, or I can tune something in my SurfaceView or fix something in ShowcaseView library?

Update

If I call mySurfaceView.setVisibility(View.INVISIBLE) just before creating ShowcaseView everything works perfect too (except that my main view area is black).

Update 2

I've read about Z-indexes of SurfaceView in documentation. I do not touch them in my code.

Upvotes: 2

Views: 1055

Answers (1)

Sherif elKhatib
Sherif elKhatib

Reputation: 45942

SOLUTION

Add setWillNotDraw(false) after calling the super constructor of your SurfaceView.


Other hints regarding surfaceview

It might be helpful to

  1. add the SurfaceView to a Container -e.g. RelativeLayout
  2. call getWindow().getDecorView()).requestTransparentRegion(mySurfaceView); after making your view visible

Upvotes: 4

Related Questions