Android ListView和WebView滚动
我正在开发一个应用程序,它有一个webview组件和一个列表视图组件。我在webview上有一个透明的布局来捕获所有用户事件。每当用户试图滚动时,我都会在webview上执行javascript滚动函数。每次调用该函数时,webview都会被滚动,并返回一个用于滚动列表视图的值。要滚动列表视图,我正在使用myListView.setSelectionFromTop(位置,y)。这里的问题是,如果我禁用listview的滚动,webview将平滑滚动。但是如果listview处于启用状态,则webview不会平滑滚动。我的最终目标是同时滚动listview和webView。但在滚动listview时,它似乎会阻塞UI线程,从而使Web视图的滚动变慢Android ListView和WebView滚动,android,android-listview,webview,android-ui,Android,Android Listview,Webview,Android Ui,我正在开发一个应用程序,它有一个webview组件和一个列表视图组件。我在webview上有一个透明的布局来捕获所有用户事件。每当用户试图滚动时,我都会在webview上执行javascript滚动函数。每次调用该函数时,webview都会被滚动,并返回一个用于滚动列表视图的值。要滚动列表视图,我正在使用myListView.setSelectionFromTop(位置,y)。这里的问题是,如果我禁用listview的滚动,webview将平滑滚动。但是如果listview处于启用状态,则web
有人能给我建议如何让它工作吗?@MysticMagic这是我的xml布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:widget="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<RelativeLayout
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginTop="26dp"
android:background="#FFFFFF"
android:gravity="center"
android:id="@+id/relLayout">
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dp"
android:divider="#D3D0D9"
android:layout_centerInParent="true"
android:background="#E2E2E2"
android:cacheColorHint="@android:color/transparent"
android:footerDividersEnabled="false"
android:gravity="center"
android:layout_gravity="center"
android:listSelector="@android:color/transparent"
android:visibility="visible"
android:fillViewport="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:id="@+id/webLayout"
android:background="#FFFFFF"
android:layout_height="fill_parent"
android:layout_toRightOf="@+id/relLayout">
<WebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none">
</WebView>
<com.example.view.CustomView
android:id="@+id/transparentView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
</RelativeLayout>