When using GLSurfaceView, all other Android views are displayed as black rectangle - android

When using GLSurfaceView, all other Android views are displayed as black rectangle, no rendering happens for any other views other than the GLSurfaceView. How to fix this?

This is fixed by setting MainActivity background to have some solid color. It is transparent by default and the other views isn't rendered.

Related

Elevation in a View with transparent background

I have a list of items with a custom background. The background is a simple shape with rounded-rect drawable filled with white color. So my view is similar to a Card. I can set an elevation on it and it works. There is a shadow beneath it.
But I want to optimize it. My window's background is white, so I thought that I can remove View's background color to reduce overdraw. But it's not that simple. As soon as I set color to transparent in my view's background drawable, elevation stops working and shadow is not drawn anymore. I've tried to use stroke instead of solid color inside my view's bakcground drawable but it doesn't work too. It's probably because of a ViewOutline. So I've created a custom OutlineProvider that returns something like this:
outline.drawRoundRect(0,0,view.getWidth(), view.getHeight(), someRadius);
Now my View has transparent background and shadow is also visible but there is something wrong with it. It does not look good. At the top of the View there is some sort of a background visible beneath it. Below is a picture of my output. On the left is a view with transparent background and a custom OutlineProvider. On the right is a view with opaque white background.
Is it a bug? Or is there another way to achieve this? It seems like it's a very simple performance optimization but it turns out that it's much more complicated than it should be.
I believe this to be related to a known issue in Lollipop https://code.google.com/p/android/issues/detail?id=78248
Thanks for the report and repro steps - this is indeed a bug, and it
has just been fixed in an internal branch. Will be released externally
in a future release.
As a workaround, you can either set an alpha on the GradientDrawable,
or set a custom outline provider on the view casting the shadow (via
View#setOutlineProvider) to query the outline from the background and
override the alpha provided by the drawable.
The issue was that GradientDrawable was being too conservative in
reporting a 0 alpha in cases where it had a transparent fill. (See
GradientDrawable#getOutline(), for the curious)

How to create a smooth transition with a view moving to overlay above an activity?

I'm investigating how the author of "inflickr"
https://play.google.com/store/apps/details?id=kr.infli
created the smooth transitions to bring his 'picture info' views above the picture itself. What method did the author use to create this effect?
Regarding Inflikr, there is only one activity involved.
The custom view (in black here) have a gesture detector and on a scroll up it will pull a details's view placed at the bottom (red frame).
The detail's view is transparent, when sliding up it increase alpha on a black shader on the custom view so the white text become readable even on a bright photo.
ps: rendered on device using scalpel
Thanks

SurfaceView transparency problem

I have this problem: i added two view instances in a framelayout. First view is a VideoView which plays in loop a video. Second view is placed above the videoview and is a surfaceview. The surfaceview draws some .png's an a white rectangle which needs a small part of the screen. The part that is not needed must be transparent. in order to do that i used the next code lines (surfaceview implemnts SurfaceHolder.Callback):
setZOrderOnTop(true);
getHolder().setFormat(PixelFormat.Transparent);
The problem is that i want to make the white rectangle semitransparent in order to see the movie played by the videoview. The transparency effect works fine on the non used part of the surfaceview but the rectangle does not became semitransparent(if a i draw a background to surfaceview the effect becomes visible.) I wait a solution from u guys.Thx
Maybe the SurfaceHolder doesn't allow alpha. Have you checked the result of PixelFormat.formatHasAlpha()? Or have you tried explicitly setting PixelFormat.RGBA_4444, RGBA_5551 or RGBA_8888 to see what happens?
mVideoView.setZOrderOnTop( true );
getHolder().setFormat( PixelFormat.RGBA_8888 );
Worked for me.

Transparent RelativeLayout which sits "on top" of a surfaceview?

I've got a canvas drawn (I have to keep the canvas, it's doing other things). I'm drawing N amount of images in this canvas, I'm wondering how would I make them clickable? also does anyone know how I could test if a bitmap is in a certain co-ord? Alternatively how would I create a button which was an image on a canvas? or even, How would I create a Transparent RelativeLayout on top of a Surfaceview?
edit.. anyone?? I'm thinking Relative Layout on top of Surfaceview would be the best way to go!
edit2: Setting things to transparent seems to just set the background to black and not actually let me see the Surfaceview I have defined under it.
Thanks,
Turns out it's already transparent and setting it to transparent just makes it black! you also just use bringtofront(); in order to make it sit "on top" of anything.

Android ViewFlipper animation does not render background?

I'm using a ViewFlipper with two ListViews. When setting a background drawable on the ViewFlipper, the animation performed when "flipping" only renders the foreground, and background is black! When animation is done, the background appears.
Is there a known problem with animating the background "layer" of a view?
Also, the animation performance/frame rate on my HTC Hero decreases significantly when adding the background.
Any ideas or solutions? Thanks!
/Morten
I have the same problem and I found the following workaround. You have to set the background on the view being animated, not on the flipper. So for consistency, this would mean you have to set the same background on all the top level views contained in your flipper.

Categories

Resources