Android的滚动问题webview内滚动视图与viewpager

问题描述:

我有一个viewpager其中包含作为父母scrollviewwebview作为child.I从来没有面临肖像模式的问题,但在横向模式下,它的行为很奇怪。Android的滚动问题webview内滚动视图与viewpager

屏幕正在拍摄肖像高度(我假设)在景观。 因此,滚动时scrollview被激活。

如果我通过放requestDisallowInterceptTouchEvent(true);来阻止触摸,但如果我这样做,我无法移动到下一页。

我给在configChanges以下

android:configChanges="keyboardHidden|orientation|screenSize" 

这里是我的主XML代码

<?xml version="1.0" encoding="utf-8"?><ScrollView 
android:id="@+id/nestedScrollView" 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:fillViewport="true"> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:id="@+id/topMostLayout"> 
    <RelativeLayout 
     android:id="@+id/topbarlayout" 
     android:layout_width="match_parent" 
     android:layout_height="43dp" 
     android:background="@android:color/white"> 
    </RelativeLayout> 



<View 
     android:layout_width="match_parent" 
     android:layout_height="2dp" 
     android:background="@android:color/darker_gray" 
     android:layout_marginBottom="4dp" /> 
    <com.mango.expert.utils.FullCard_ShadowLayout 
     android:id="@+id/activity_shadow_layout" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:sl_cornerRadius="7dp" 
     app:sl_shadowColor="@color/shadow"> 
     <FrameLayout 
      android:id="@+id/dummyLayoutForViewPager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      > 
<LinearLayout 
       android:id="@+id/dummyLinearLayout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" 
       android:layout_margin="2dp" 
       android:background="@drawable/for_full_card_bg" > 
      </LinearLayout> 
     </FrameLayout> 
    </com.mango.expert.utls.FullCard_ShadowLayout> 

<android.support.v4.view.ViewPager 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/view_pager" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_weight="1"> 

</android.support.v4.view.ViewPager> 

有些标签丢失,我发现在粘贴XML here.xml困难完全没问题。 任何帮助将是非常great.Forgot一提的是网页视图是碎片和滚动型是主要布局

+0

世界上没有其他需要补充的WebView内滚动视图 – Mrinmoy

+0

如果我删除滚动型我无法看在景观模式下的全部内容 – venky

你并不需要实现滚动型的WebView。它已经具备了自己的特色。

+0

我尝试通过删除滚动视图,但我无法看到横向模式下的全部内容,因为它为纵向拍摄纵向高度 – venky

+1

我认为您没有应用高度作为xml文件中的“match_parnet”。 – bharat7777

+0

,我给了match_parent – venky

于母公司布局启用NestedScrolling:

parent.setNestedScrollingEnabled(true); 

或包裹内NestedScrollView您的整个布局:

<android.support.v4.widget.NestedScrollView 
     android:id="@+id/nScrollView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true"> 

     <FrameLayout ...> 
      <ViewPager ... /> 
     </FrameLayout > 
    </android.support.v4.widget.NestedScrollView> 
+0

感谢您的回答我会尝试并让您知道 – venky

+0

不幸的是没有工作,它阻止了正常的webview滚动也肖像模式 – venky

+0

你可以粘贴你的XML代码的问题? –