我正在构建一个包含输入表单和 WebView 的应用程序。该项目位于http://code.google.com/p/android-sap-note-viewer/
WebView 将根据输入呈现一个网站,这个页面有一个包含主要内容的 DIV(可能是数百行)。我无法控制网站上的内容。
Android WebKit 似乎没有在 DIV 中进行任何滚动,参考http://www.gregbugaj.com/?p=147。因此,只有部分 DIV 显示给用户,没有检索其余文本的方法。我的挑战是找到一种显示所有 DIV 文本的方法。
我的观点定义如下:
<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>
在这里,我尝试将 WebView 硬编码为较大的高度,以确保 DIV 被拉伸并显示所有文本,并强制 LinearLayout 进行滚动。
但是,WebView 总是适应屏幕大小(在大多数情况下这会很好,但不是这样)。
关于如何解决这个问题的任何想法?
(我现在看到的唯一解决方案是自己获取 HTML,删除 DIV 并将其发送到 WebView)