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>
尝试在HTML页面中设置透明背景颜色。 – Steelight
我不确定这会适用于我的情况。因为我将从网页中动态获取HTML。 – osayilgan
它至少会让你知道问题是否存在。 – Steelight