WebView display nothing with TabHost

by elephantbug » Fri, 12 Sep 2008 06:51:05 GMT


Sponsored Links
 i,

The WebView shows nothing the very first time, however, if you switch
to other TAB and return back, everything is displayed.

Here is my XML file:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?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:gravity="center">

<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TabWidget
android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="450px"
android:paddingTop="60px">

<LinearLayout
android:id="@+id/legal_layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="400px">

<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="350px"
android:background="@drawable/silver">
>
<WebView
android:id="@+id/legal_view"
android:layout_width="fill_parent"
android:layout_height="350px"
android:minHeight="350dp"
android:textColor="@drawable/dark"
android:padding = "3dip"
android:paddingLeft = "3dip"
android:paddingRight = "3dip"
android:paddingTop = "3dip"
android:paddingBottom = "3dip"
android:text="test"/>
</ScrollView>

<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop = "3dip"
android:gravity="center">

<Button
android:id = "@+id/button_accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_accept_text"/>

<Button
android:id = &



WebView display nothing with TabHost

by Mark Murphy » Fri, 12 Sep 2008 07:19:19 GMT


 


Don't put WebView in a ScrollView. It does its own scrolling.

I don't know if that is your problem, but it is worth a try.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Warescription: All titles, revisions, & ebook formats, just $35/year

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


WebView display nothing with TabHost

by elephantbug » Fri, 12 Sep 2008 10:12:15 GMT


 Mark,

I tried that. The problem still persists...

I even tried to some simple Html in onCreate method... nothing
displayed at all..






--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by dai » Fri, 12 Sep 2008 10:28:57 GMT


 elephantbug, what kind of web page are you trying to display? Perhaps
 http://www.google.com ?

If you do try to show web pages using javascript like...above page,
you have to set-on javascript.

/** enabling js manually */
webView.getSettings().setJavaScriptEnabled(true);

hope this helps






--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by Megha Joshi » Fri, 12 Sep 2008 11:57:33 GMT


 008/9/11 elephantbug <[EMAIL PROTECTED]>



If loadAllLegalText() is something that puts data into TOC below, is it a
blocking call? You may want to check if TOC actually contains data when you
call loadData()..


--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by elephantbug » Sat, 13 Sep 2008 02:23:06 GMT


 i,

The LoadAllLegalText is not a blocking call or different thread. The
TOC has been initialized when it is loaded.

I tried following code even:
legalText = (WebView)findViewById(R.id.legal_view);
legalText.loadData("<html><body>boo</body></html>", mimeType,
encoding);

Still nothing displayed..


On Sep 11, 8:56pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:

--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by Megha Joshi » Sat, 13 Sep 2008 06:07:22 GMT


 t seems like you won't get the proper hook into the WebView for changing
its contents on load, if you load tab's content by id.
I was able to make this work using TabContentFactory. For sample code see
the ApiDemos/Views/Tabs sample.
On subsequent tab clicks you could change the content dynamically using
OnTabChangeListener.

2008/9/12 elephantbug <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by elephantbug » Sat, 13 Sep 2008 15:55:28 GMT


 i, Megha,

It works!!!...

Thanks so much.

--elephantbug

On Sep 12, 3:07pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. bluetooth and mail

hello friends
I want if you can a source code for application "bluetooth file
exchange" and "client mail"  lot thanks if you can help me
--~--~---------~--~----~------------~-------~--~----~

2. syncing a mobile app with a database server

Hi,

I'm very new to Android, so I'm still trying to figure out the basics.
I want to write an application that needs to communicate with a
database server, and upload it's contact list to the server. In this
regard I have the following questions:

1). Is there a way to associate a phone number to an Android
application?

2) How does my app communicate with the server? It needs to host a web
address I guess. What's the way to do this?

I'll really appreciate if somebody could help me.

thanks,

--~--~---------~--~----~------------~-------~--~----~

3. send attachment to gmail

4. Choosing the right activity from a notification

5. dlopen() behaving weird

6. 100 euros laptop

7. Real Device in market with google Android