Question

I'm using ICS and trying to show a transparent Renderscript layer over a regular view. I would like to use RS to draw text on the app.

I'm using the setAlpha(8, 8); and I can see that the layer generated it's BGRA (dumpsys SurfaceFlinger).

My RS script is simply doing this:

rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
rsgDrawText("Hello!", 50,50);

I would like to be able to show this Renderscript layer drawing text, over my regular view.

My main activity uses setContentView two times, one for my main view, and second one for the RS. Even if this approach might be wrong, I should at least be able to see the background of the app, while I only see black and the "Hello!" text in white covering everything. I also tried using two different activities, but I've never been able to make the RenderScript layer transparent.

Any ideas?

Was it helpful?

Solution

You also need to set the PixelFormat and ZOrder of your Renderscript view. Try adding this when you create your Renderscript view:

view.getHolder().setFormat(PixelFormat.TRANSLUCENT);
view.setZOrderOnTop(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top