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. Does Activiy ca released and gc after calling finish()?

Hi all

i have the problem about Activity#finish

my code like

class A1(){
   onclick(){
     startIntent(A1.this, A2.class);
     finish();
   }
}

class A2(){
   private byte[] temp = new byte[3*1024*1024]; //3mb
   onclick(){
     startIntent(A2.this, A1.class);
     finish();
   }
   onDestroy(){
   //do nothing
   }
}

then it will cause outofmemory error after i click button few
times(moving between A1 and A2)

if i add "temp  = null" in A2's onDestroy, then it goes well.
but i dont know why A2's member variable temp didnt garbage collected
after calling finish.(using ddms's cause gc doesnt work,too)


thanks

koji




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

2. Story about interesting Android apps

Hello,
My name is Vas and I am a reporter for Silicon Alley Insider (
www.alleyinsider.com), a tech news site based out of NYC. I am trying to put
together a story about interesting apps being developed for Android, and I
was hoping that if you're a developer, you would be willing to pitch me your
app, so I could write about it. I'm working on the story for the next week,
so any pitches would be greatly appreciated.

Thanks,
Vas

-- 
Vasanth Sridharan
Reporter
Silicon Alley Insider
C: (408) 455-2254
http://www.alleyinsider.com
http://www.vasanthsridharan.com

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

3. spawning a dialog from the NotificationManager

4. Default GPS location provider not in file explorer

5. Viwes are not visible on screen

6. All Developers -

7. Alternative for intent.getExtra()?