【发布时间】:2014-09-24 14:51:47
【问题描述】:
所以我正在制作一个看起来像这样的布局:
|----------------|
| |
| WebView |
| |
|----------------|
| List element |
|----------------|
| List element |
|----------------|
| List element |
|----------------|
| List element |
|----------------|
我想让我的 WebView 与 List 元素一起向上滚动,所以我制作了一个 ListView,其中第一个元素是 webview。主要布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/overview_listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
还有一个 WebView 元素布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<WebView
android:id="@+id/overview_cell_webview"
android:layout_width="match_parent"
android:layout_height="300dp" />
</LinearLayout>
到目前为止,一切都很好。它显示 web 视图,但平移和缩放效果不佳。它的“迟钝”。在放下手势之前,您可以平移或缩放非常小的距离,并且缩放/平移会停止。您需要一遍又一遍地捏合,以实现较大的缩放级别。
我尝试主要使用 requestDisallowInterceptTouchEvent() 来解决这个问题,但到目前为止还没有成功。我应该在webview上设置它吗?包含 webview 的 LinearLayout?还是完全不同的东西?
实现这一点的正确方法是什么,我的 web 视图可以缩放但仍会随着列表元素滚动?
【问题讨论】:
标签: android android-layout listview webview scrollview