开发者

Android: Transparent WebView over Camera Preview

Just a general question and maybe someone has an idea: Is it possible to have a transparent WebView over a Camer开发者_如何学Ca SurfaceView and use HTML/CSS for creating the overlay?


<!-- 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);


Have you tried, setting transparent background for the WebView and overlaying it atop SurfaceView using FrameLayout ?


Add the surfaceview and the webview to a framelayout, then mWebview.setBackgroundColor(0x00000000) works for me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜