user1979646
user1979646

Reputation: 41

webview transparent background §?

Can someone tell me why on my Samsung S3 (v 4.1.1) a webview has a transparent background and on the xperia U (v 4.0.1) it has a black background?

I use in the java code 'webView.setBackgroundColor(0x00FFFFFF)' and in the html '<body style="background: transparent">'.

Upvotes: 1

Views: 1260

Answers (4)

Vitaliy A
Vitaliy A

Reputation: 3838

Also try webView.setBackgroundColor(0x00000000);

Upvotes: 0

Pit0r
Pit0r

Reputation: 160

I had the same problem. All webviews on Xperia with Android 4.0.4 had opaque backgrounds, no matter what I did.

The solution was to disable hardware acceleration in all activities containing the bug ridden webviews.

Try to add this to the activity nodes in AndroidManifest.xml

android:hardwareAccelerated="false"

It worked for me.

Upvotes: 2

V.P.
V.P.

Reputation: 612

please use this, it's work for me

<WebView
            android:id="@+id/webview1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fitsSystemWindows="true"
            android:background="@android:color/transparent"
            android:scrollbarStyle="insideOverlay"
            android:scrollbars="none" />

Upvotes: 1

Vipin Sahu
Vipin Sahu

Reputation: 1451

It basically due to activity theme that different vendor use to style the view and change their look and feel.In this case you can extends webview and overide the setBackgroungColor(int color) method and do delcare your activity theme .you will always see difference in view like listview , progress bar check box , etc look different on different vendor devices.

Upvotes: 0

Related Questions