简体   繁体   English

Android禁用WebView反弹

[英]android disable webview bounces

I have set a LinearLayout with admob and WebView . 我已经用admobWebView设置了LinearLayout When admob appears on top, WebView Y pos is properly repositioned to 0 + adMobHeight . admob出现在顶部时, WebView Y pos正确地重新定位为0 + adMobHeight

Then if you touch and drag WebView , you are able to move vertially same admob height! 然后,如果您触摸并拖动WebView ,就可以垂直移动相同的admob高度! This property on iOS is called bounces . iOS上的此属性称为bounces

How to deactivate it? 如何停用它?

If not possible, hot to force WebView to recalculate its size whitout reloading content? 如果不可能,是否可以强制WebView重新计算其大小(如果不重新加载内容)? Thank you 谢谢

Please note that scrolls are alreary disabled, 请注意,滚动条一直被禁用,

    webviewB.setVerticalScrollBarEnabled(false);
    webviewB.setHorizontalScrollBarEnabled(false);

If you always want to display on top of the screen then you may want to consider using RelativeLayout. 如果您始终希望显示在屏幕顶部,则可能需要考虑使用RelativeLayout。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

  <com.admob.android.ads.AdView
  android:id="@+id/ad" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
  app:backgroundColor="#000000"
  app:primaryTextColor="#FFFFFF"
  app:secondaryTextColor="#CCCCCC"
  android:layout_alignParentTop="true"
/>

<!-- WebView below that -->

<!--WebView-->

</RelativeLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM