You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 21:44:53