[android-developers] Re: Dimmed GLSurfaceView in AlertDialog

2012-02-15 Thread James Webster
Cracked it!

The clue was I remembered reading recently about SurfaceViews and
them punching holes in things and GLSurfaceView is obviously a
SurfaceView.

http://developer.android.com/reference/android/view/SurfaceView.html

The surface is Z ordered so that it is behind the window holding its
SurfaceView; the SurfaceView punches a hole in its window to allow its
surface to be displayed.

So it punches a hole through the window, in this case a dialog, to display
the GLSurfaceView on the window beneath. Since the window beneath a dialog
is always shown as dimmed, hence the GLSurfaceView also gets that dimmed
effect.

The way round it is use:

setZOrderOnTop(true);

on the GLSurfaceView in question. This shows the GLSurfaceView on top of
the hosting window, rather than behind it. It has the downside that you
can't use overlays of any views on top of your SurfaceView, the surface
will always be shown on top of them, but in my particular case that doesn't
matter.

So it is possible to use a GLSurfaceView in a dialog, and also in an
activity using the dialog theme.

On 15 February 2012 01:23, James Webster duskjock...@gmail.com wrote:

 Further to this, I tried build target on ICS, same visual behavior. The
 Surface view appears dimmed, as if it has been given the same dimming
 effect as the background behind the dialog.

 Is GlSurfaceView not supported in Dialogs? Nothing in the docs about that
 that I can see.
 On Feb 13, 2012 11:33 PM, James Webster duskjock...@gmail.com wrote:

 I have a GLSurfaceView working fine as a Live Wallpaper and as a custom
 view in an activity.

 When I try to use it as a custom view in an AlertDialog, the
 GLSurfaceView does not display correctly, there are some visual problems
 (see attached image for reference).

 Firstly the GLSurfaceView area within the dialog appears dimmed, as it
 has been given the same dimming affect as the activity behind, yet the rest
 of the dialog controls appear un-dimmed.

 Secondly, part of the activity behind (in this case a grid view) appears
 to completely overlap the dialog in the top left corner, the area
 overlapping seems to correspond to the size of a grid item. How can the
 background activity be shown over the foreground dialog? Most strange...

 Am I trying to do something stupid, and GLSurfaceView's are simply not
 supported in AlertDialogs?

 Incidentally, in my normal activity which does show the GLSurfaceView
 correctly, if I changed the theme to use the android:theme=
 @android:style/Theme.Dialog
  then I also see the same dimming effect on the GLSurfaceView, which
 leads me to wonder if it is an issue with the dialog style itself.

 Is it expected that a GLSurfaceView should be displayed correctly within
 a dialog or Activity using a dialog theme? Has anyone done that before with
 no issues?

 Build target 2.1 and testing on 3.2 and 2.5.3, for what its worth.

 Regards,
 James

 Dusk Jockeys Android Apps
 http://duskjockeys.blogspot.com/




-- 
Regards,
James

Dusk Jockeys Android Apps
http://duskjockeys.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Dimmed GLSurfaceView in AlertDialog

2012-02-14 Thread James Webster
Further to this, I tried build target on ICS, same visual behavior. The
Surface view appears dimmed, as if it has been given the same dimming
effect as the background behind the dialog.

Is GlSurfaceView not supported in Dialogs? Nothing in the docs about that
that I can see.
On Feb 13, 2012 11:33 PM, James Webster duskjock...@gmail.com wrote:

 I have a GLSurfaceView working fine as a Live Wallpaper and as a custom
 view in an activity.

 When I try to use it as a custom view in an AlertDialog, the
 GLSurfaceView does not display correctly, there are some visual problems
 (see attached image for reference).

 Firstly the GLSurfaceView area within the dialog appears dimmed, as it has
 been given the same dimming affect as the activity behind, yet the rest of
 the dialog controls appear un-dimmed.

 Secondly, part of the activity behind (in this case a grid view) appears
 to completely overlap the dialog in the top left corner, the area
 overlapping seems to correspond to the size of a grid item. How can the
 background activity be shown over the foreground dialog? Most strange...

 Am I trying to do something stupid, and GLSurfaceView's are simply not
 supported in AlertDialogs?

 Incidentally, in my normal activity which does show the GLSurfaceView
 correctly, if I changed the theme to use the android:theme=
 @android:style/Theme.Dialog
  then I also see the same dimming effect on the GLSurfaceView, which
 leads me to wonder if it is an issue with the dialog style itself.

 Is it expected that a GLSurfaceView should be displayed correctly within a
 dialog or Activity using a dialog theme? Has anyone done that before with
 no issues?

 Build target 2.1 and testing on 3.2 and 2.5.3, for what its worth.

 Regards,
 James

 Dusk Jockeys Android Apps
 http://duskjockeys.blogspot.com/



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en