2012-05-31 69 views
1

我有一个webview的布局,我想使webview的背景颜色透明。我尝试了一些不同的方式和Android中WebView中的半透明背景颜色

webView.setBackgroundColor(Color.argb(128, 0, 0, 0));

对我来说这一个工作。但问题是我不能使整个webview透明,只有webview的右侧有一个小条透明背景,其余的webview有黑色背景。 任何使整个webview透明的想法? 在这里我上传了截图,你可以查看我的xml和java代码。 ,如果你也知道如何使视图具有半径边界,它也可以很好。由于

protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.aboutus); 

    String webData = StringHelper.addSlashes("<font color=\"#6495ed\">TEST</font>"); 

    webView = (WebView) findViewById(R.id.webview); 
    webView.loadData(webData, "text/html", "UTF-8"); 
    webView.setBackgroundColor(Color.argb(128, 0, 0, 0)); 
} 

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:background="@drawable/bg2" 
android:weightSum="100" > 

<ImageView 
    android:id="@+id/about_us_header_image" 
    android:layout_height="0dip" 
    android:layout_width="match_parent" 
    android:background="@drawable/header" 
    android:layout_weight="20" 
    android:visibility="invisible" 
    /> 

<WebView 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="0dip" 
    android:layout_weight="80" 
    android:layout_margin="20dp" 
    /> 
</LinearLayout> 

enter image description here

+1

尝试在HTML页面中设置透明背景颜色。 – Steelight

+0

我不确定这会适用于我的情况。因为我将从网页中动态获取HTML。 – osayilgan

+0

它至少会让你知道问题是否存在。 – Steelight

回答

1

在计算器搜索后,我已经看到了它的不仅​​有这个问题,我发现了一个变通的devies 2.2xx和2.3xx这里是下面的链接。 。

Here是链接到我的解决方案。