Just a general question and maybe someone has an idea: Is it possible to have a transparent WebView over a Camera SurfaceView and use HTML/CSS for creating the overlay?
Asked
Active
Viewed 2,602 times
3 Answers
1
<!-- in XML -->
<WebView android:id="@+id/webkit"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:maxWidth="200dip"
android:maxHeight="200dip"
android:layout_marginBottom="4dip"
android:adjustViewBounds="true"
android:visibility="gone"
/>
// onCreate
barcodeBrowser = (WebView)findViewById(R.id.webkit);
... // somewhere in runtime
barcodeBrowser.setVisibility(View.VISIBLE);
String downloadLink = "http://stackoverflow.com/questions/1260422/setting-webview-background-image-to-a-resource-graphic-in-android";
barcodeBrowser.setBackgroundColor(Color.argb(0,0,0,0));
barcodeBrowser.setBackgroundResource(R.drawable.icon);
barcodeBrowser.loadUrl(downloadLink);

Roger Alien
- 3,040
- 1
- 36
- 46
0
Add the surfaceview and the webview to a framelayout, then mWebview.setBackgroundColor(0x00000000) works for me

Fernando Gallego
- 4,064
- 31
- 50
0
Have you tried, setting transparent background for the WebView
and overlaying it atop SurfaceView
using FrameLayout
?

Samuh
- 36,316
- 26
- 109
- 116
-
Tried that - doesn't work really. I don't get the WebView transparent. Tried everything from setBackground(0) to CSS transparent statements. The WebView stays white. – flyandi Feb 27 '11 at 10:28