Html 基于ImageView Android的WebView

Html 基于ImageView Android的WebView,html,android-layout,android-webview,android-imageview,Html,Android Layout,Android Webview,Android Imageview,我读过多篇关于如何在ImageView上显示WebView的解决方案的帖子。以下是我上次尝试的,但仍然不起作用: mPhotoWebView.setWebViewClient(new WebViewClient()); mPhotoWebView.setBackgroundColor(0x00000000); xml: 此代码需要在4.2.2上运行。我试图实现的是,webview用html5编写了动画代码,而imageView是动画需要显示的背景图像 有什么想法吗?我以前一定错过了这个组合

我读过多篇关于如何在ImageView上显示WebView的解决方案的帖子。以下是我上次尝试的,但仍然不起作用:

 mPhotoWebView.setWebViewClient(new WebViewClient());
 mPhotoWebView.setBackgroundColor(0x00000000);
xml:

此代码需要在4.2.2上运行。我试图实现的是,webview用html5编写了动画代码,而imageView是动画需要显示的背景图像


有什么想法吗?

我以前一定错过了这个组合。我的最终解决方案是:

不要在代码中将背景色设置为webView

    body 
    {
        background:transparent;
        overflow: hidden;
        background-color: rgba(10,10,10,0.5);
    }
xml:


这里的关键是软件层类型。我正在使用一个片段,其中一个活动处理多个片段,因此我无法在清单中执行此操作。因此,我在xml中这样做了。

我终于实现了这一点。见下面的答案。
body 
{
    background:transparent;
    background-color: rgba(10,10,10,0.5);
}
    body 
    {
        background:transparent;
        overflow: hidden;
        background-color: rgba(10,10,10,0.5);
    }
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="300dp" >

    <com.accuweather.android.views.MyImageView
        android:id="@+id/photoImageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <WebView
        android:id="@+id/photoWebView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent"
        android:layerType="software"
        android:scrollbarStyle="insideOverlay"
        android:scrollbars="none" />