Reputation: 5893
I have a webview in one of lay out and I want make the background color of the webview transparent. I tried the some different ways and
webView.setBackgroundColor(Color.argb(128, 0, 0, 0));
this one worked for me. But the problem is I cannot make the whole webview transparent, only the right side of the webview has a tiny strip transparent background and the rest of the webview has black background. Any Idea for making whole webview transparent ? Here I have uploaded screenshot and you can check out my xml and java code. and if you also know how to make the view has radius borders it could also be nice. Thanks
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>
Upvotes: 1
Views: 5441