我在其中一个布局中有一个 webview,我想让 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>