I was trying to put a transparent HTML overlay over my GL view but it has always black flickering which covers my GL view. After several days trying to get rid of this flickering I found this workaround which is acceptable for me (but a shame for android).
The problem is that I need hardware acceleration for my nice CSS animations and so webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
is not an option for me.
The trick was to put a second (empty) WebView
between my GL view and the HTML overlay. This dummyWebView
I told to render in SW mode, and now my HTML overlays renders smooth in HW and no more black flickering.
I don't know if this works on other devices than My Acer Iconia A700, but I hope I could help someone with this.
public class MyActivity extends Activity {
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
RelativeLayout layout = new RelativeLayout(getApplication());
setContentView(layout);
MyGlView glView = new MyGlView(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
dummyWebView = new WebView(this);
dummyWebView.setLayoutParams(params);
dummyWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
dummyWebView.loadData("", "text/plain", "utf8");
dummyWebView.setBackgroundColor(0x00000000);
webView = new WebView(this);
webView.setLayoutParams(params);
webView.loadUrl("http://10.0.21.254:5984/ui/index.html");
webView.setBackgroundColor(0x00000000);
layout.addView(glView);
layout.addView(dummyWebView);
layout.addView(webView);
}
}