views:

839

answers:

2

Hi,

I am building an app which contains an input form and a WebView. The project is available at http://code.google.com/p/android-sap-note-viewer/

The WebView will render a website based on the input and this page has a DIV with the main contents (could be hundreds of lines). I have no control of the contents on the website.

Android WebKit doesn't seem to do any scrolling in a DIV, ref http://www.gregbugaj.com/?p=147. Therefore, only parts of the DIV is shown to the user, with no method of retrieving the rest of the text. My challenge is to find a way that all the text of the DIV is shown.

My view is defined as the following:

    <LinearLayout android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <TextView android:layout_width="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_height="wrap_content" 
            android:text="@string/lblNote" />
        <EditText android:id="@+id/txtNote" 
          android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:layout_weight="1"
            android:numeric="decimal"
            android:maxLength="10"
            />
        <Button android:id="@+id/bView" 
          android:text="@string/bView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
             />
    </LinearLayout>    

    <WebView 
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:isScrollContainer="false"
    android:keepScreenOn="false"
    android:minHeight="4096px"
    />

</LinearLayout>

Here I've tried to hardcode the WebView to a large height in order to make sure the DIV is stretched out and shows all the text, and also force the LinearLayout to do the scrolling.

However, the WebView is always adapting to the screen size (which would be good in most cases, but not this).

Any ideas on how to solve this problem?

(only solution I see now is to fetch the HTML myself, remove the DIV and send it to the WebView)

A: 

I think, you can put a ScrollView outside the LinearLayout

Bennet
will try and come back with the results
dparnas
A: 

Hi, I want to convert an .docx/.doc file to html and displaying in emulator with help of Web- view. But i am displaying entire data into webview as Single page(we need to scroll many times). So, i want to match the content of .docx file with webview as pages or put some buttons or gestures to get next page.But i unable to display text as pages in Web-View.

is there any solution or suggestion to get as pages?

How to get the height and width of webview?

Thanks

Jetti
Hi, It would be best to "fork" this answer out as a separate question. Unfortunately, I have no good answer for you at this time.
dparnas