2014-11-24 2 views
0

webview 구성 요소와 목록보기 구성 요소가있는 응용 프로그램을 개발 중입니다. 나는 모든 사용자 이벤트를 캡처하기 위해 내 webview에 투명한 레이아웃을 가지고 있습니다. 사용자가 스크롤하려고 할 때마다 webview에서 javascript scroll 함수를 실행합니다. 함수가 호출 될 때마다 webview get scrolled가 발생하고 목록보기를 스크롤하는 데 사용되는 값이 반환됩니다. 내 목록보기를 스크롤하려면 myListView.setSelectionFromTop (pos, y)을 사용하고 있습니다. 여기에서 문제는 목록 뷰를 스크롤하지 못하게하면 웹 뷰가 부드럽게 스크롤됩니다. 그러나 목록보기가 활성화되어 있으면 웹보기가 부드럽게 스크롤되지 않습니다. 내 궁극적 인 목표는 동시에 listview 및 webView 스크롤하는 것입니다. 그러나 목록보기를 스크롤하는 동안 UI 스레드를 차단하여 웹보기를 느리게 스크롤하는 것처럼 보입니다.ListView 및 WebView 스크롤

아무에게도이 방법을 제안 할 수 있습니까? 여기

+0

당신이 XML을 공유 할 수있다? –

답변

0

@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>