Hi, Megha,

It works!!!...

Thanks so much.

--elephantbug

On Sep 12, 3:07 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> It 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]>
>
>
>
> > Hi,
>
> > 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:56 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> > > 2008/9/11 elephantbug <[EMAIL PROTECTED]>
>
> > > > Hi,
>
> > > > 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 = "@+id/button_cancel"
> > > >                            android:layout_width="wrap_content"
> > > >                            android:layout_height="wrap_content"
> > > >                            android:text="@string/button_cancel_text"/>
>
> > > >                        </LinearLayout>
>
> > > >        </LinearLayout>
> > > >                </FrameLayout>
> > > >        </TabHost>
>
> > > >        </LinearLayout>
>
> > > > ++++++++++++++++++++++++++++++++++++++++++++
> > > > here is part of my code for onCreate:
>
> > > >                //load gloabl asset
> > > >                loadAllLegalText();
>
> > > 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()..
>
> > > >                //init the view
> > > >                setContentView(R.layout.legal);
>
> > > >                tabHost = (TabHost) findViewById(android.R.id.tabhost);
> > > >                tabHost.setup();
>
> > > >                legalText = (WebView)findViewById(R.id.legal_view);
> > > >                legalText.getSettings().setJavaScriptEnabled(true);
> > > >                legalText.loadData(TOC, mimeType, encoding);
>
> > > >                Resources rs = getResources();
> > > >                tabHost.addTab(tabHost.newTabSpec(TAG_LEGAL_TOC)
>
> > > >  .setIndicator(rs.getText(R.string.legal_tab_indicator_toc))
> > > >                                .setContent(R.id.legal_layout));
>
> > > >                tabHost.addTab(tabHost.newTabSpec(TAG_LEGAL_NOTICE)
>
> > > >  .setIndicator(rs.getText(R.string.legal_tab_indicator_legal))
> > > >                                .setContent(R.id.legal_layout));
>
> > > >                tabHost.addTab(tabHost.newTabSpec(TAG_LEGAL_PRIVACY)
>
> > > >  .setIndicator(rs.getText(R.string.legal_tab_indicator_privacy))
> > > >                                .setContent(R.id.legal_layout));
>
> > > >                ......
> > > >                //set focus
> > > >                tabHost.setOnTabChangedListener(this);
> > > >                tabHost.setCurrentTabByTag(TAG_LEGAL_TOC);
>
> > > > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> > > > There is one thread about WebView display nothing and I tried their
> > > > suggestion, none works...
>
> > > > Anyone has any clue? or it is Android's bug.
>
> > > >http://code.google.com/p/android/issues/detail?id=678
>
> > > >http://www.mail-archive.com/[email protected]/msg02.
> > ..
>
> > > > --elephantbug

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to