Quasar Capacitor项目中android:overScrollMode="never"不生效问题
解决Capacitor Android滚动拉伸效果未禁用的问题
先确认布局结构是否正确
你添加的ScrollView必须完整包裹Capacitor的WebView组件才会生效,空的ScrollView标签起不到作用。正确的activity_main.xml结构应该是这样:<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:overScrollMode="never"> <com.getcapacitor.widget.CapacitorWebView android:id="@+id/capacitor_webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </ScrollView> </LinearLayout>直接给WebView配置禁用属性
多数情况下,滚动拉伸效果来自WebView本身,和外层容器无关。直接在WebView标签里添加以下属性即可:android:overScrollMode="never"禁用系统级边缘拉伸效果
如果以上方法都无效,可能是Android系统的窗口边缘效果导致的。打开MainActivity.java,在onCreate方法中添加这段代码:@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setOverScrollMode(View.OVER_SCROLL_NEVER); }检查Capacitor配置项
查看capacitor.config.ts中是否开启了滚动相关的增强配置,如有则关闭后重试。
内容的提问来源于stack exchange,提问作者Fanil
相关产品推荐
相关产品推荐

