2011-02-27 78 views

回答

0

您是否尝试过为WebView设置透明背景并使用FrameLayout将其覆盖在SurfaceView的顶部?

+0

试过了 - 没有真正发挥作用。我不明白WebView。尝试从setBackground(0)到CSS透明语句的所有内容。 WebView保持白色。 – flyandi 2011-02-27 10:28:57

+0

你尝试过'setBackgroundColor(0)'吗? – Samuh 2011-02-27 11:04:23

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

的surfaceview和web视图添加到FrameLayout里,然后mWebview.setBackgroundColor(00000000)对我的作品