osayilgan
osayilgan

Reputation: 5893

Semi-Transparent background color in WebView in Android

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>

enter image description here

Upvotes: 1

Views: 5441

Answers (1)

osayilgan
osayilgan

Reputation: 5893

After searching on the stackoverflow I've seen that its not only having this issue, and I found a work around for the devies 2.2xx and 2.3xx here is the link below..

Here is the link to my Solution.

Upvotes: 1

Related Questions