2012-05-11 44 views
1

我的WebView出现了一些奇怪的问题。问题是如果它比屏幕长,我不能在Android 2.2和2.3中滚动页面。滚动WebView的唯一方法是在Android 4.0.3中。有什么问题,或者它只是不可能滚动Android版本低于4.0.3的WebView?不能在Android中滚动webview

这是我的布局:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="fill_parent" android:id="@+id/rltvLayout01" 
    android:layout_height="fill_parent" android:background="@color/white"> 
    <LinearLayout android:id="@+id/LinearLayout01" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@+id/ad_layout"> 
      <WebView android:id="@+id/webview" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:fitsSystemWindows="true" 
       android:scrollbars="none" /> 
    </LinearLayout> 
    <LinearLayout android:id="@+id/ad_layout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"> 
      <com.google.ads.AdView android:id="@+id/ad" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       ads:adUnitId="-------------" 
       ads:loadAdOnCreate="true" 
       ads:adSize="BANNER" /> 
    </LinearLayout> 
</RelativeLayout> 

编辑23:06:

我刚刚发现的问题!我使用的实际代码不会导致这种行为,它是导致问题的加载网站。在我的移动网站上,我使用视口来正确显示,而FroYo和姜饼的WebView无法很好地处理。所以在移除视口元标记之后,它非常完美!无论如何,谢谢你,托马斯K,垂直方向也使它可以在移除视口后滚动!

因此,如果您希望让您的webview在Froyo和姜饼中工作,那么请去掉html代码中的视口标签!

回答

1

添加

android:orientation="vertical" 

android:orientation="horizontal" 

到的LinearLayout

+0

出于某种原因,我仍然不能滚动:( – MartijnG

+0

这为我工作=/ – Thkru

+0

是否有可能,它与relativelayout或别的东西有关系吗?或者甚至可能是项目中的其他代码?据我所知我触摸垂直滚动无处... – MartijnG