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. Eclipse IDE for Android platform development & android.jar

When I want to build a application ,in Eclipse, using
"android.opengl.Object3D" whereas it's not in SDK android.jar.
Then I checked the web-site "http://source.android.com/using-eclipse"
teaching you how to use whole android opensource in Eclipse and
debugging.

My questions are:
1. Is there any purpose that original SDK android.jar does not include
some packages ? for simplified use ?

2. Can I generate another (full set) JAR file to contain those
packages listed in "<android>/development/ide/eclipse/.classpath" ?

3. <Combined the Q1/Q2 above> For ex., in PC Eclipse env, If I want to
build an application utilized "android.opengl.Object3D", is there any
good step-by-step instructions to follow, and even refer to the whole
android framework classes such as "android.pim.DateUtils" ?

4. (Followed item2 above) When I open a new Java project with that
".classpath" on Eclipse and try to export that project as a JAR file,
I got several duplicate entry error and then failed, what could be the
wrong I made here ?


tks

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

2. How can i access System directory in an emulator ??

Hi all:
     It seemed that some work can  not be done due to permission
reasons unless my APK is  in installed in the System/app
directory ,So,is there any way i can do that ??
    Thanks in advance ~!
--~--~---------~--~----~------------~-------~--~----~

3. Google, thank you! (Android could make life for blind people easier)

4. Developing an IMS client on Android : Request for Comments

5. How to track menu navigation focus changes?

6. Stumped on launching Market app

7. how to Start onRunning Activity without restarting??