Skip to content Skip to sidebar Skip to footer

Webview In Tabhost = Starting As Black Screen

I'm trying to use a webview inside a tabhost that has 4 tabs - all linked to the same webview. This is great except for one problem: At start up the webview is black. Clicking ta

Solution 1:

Break through!

I found the answer to my own question in another SO post that I didn't stumble upon in the past: Why is my TabHost's FrameLayout's only child loaded with visibility = View.GONE?

Simply setting:

tabHost.getCurrentView().setVisibility(View.VISIBLE);

That fix the issue!

Solution 2:

I was having similar problem. As suggested, I put tabHost.getCurrentView().setVisibility(View.VISIBLE); to the code, the webview still come out blank. After a few more searches, this answer saved me. It turns out that it's important to set android:layout_height="wrap_content" to the webview.

Post a Comment for "Webview In Tabhost = Starting As Black Screen"