How to get transparent background of webView for 4.0 version

前端 未结 3 807
一生所求
一生所求 2020-12-18 18:43

I am looking for a piece of code which is able to get a transparent background in a WebView for version 4.0 and above. My code is working fine with version 2.3

相关标签:
3条回答
  • 2020-12-18 19:12

    If webview is scrolable:

    Add this to the Manifest:

    android:hardwareAccelerated="false"
    

    OR

    Add the following to WebView in the layout:

    android:background="@android:color/transparent" android:layerType="software"
    

    Add the following to the parents scroll view:

    android:layerType="software"
    
    0 讨论(0)
  • 2020-12-18 19:14

    Try this:

    webView.setBackgroundColor(0x00000000);
    

    and remove android:hardwareAccelerated ="true"
    as that is off-topic.

    0 讨论(0)
  • 2020-12-18 19:21

    setBackgroundColor(0x00000000); will make your webview transparent

    0 讨论(0)
提交回复
热议问题