如何停止线性布局以与Webview滚动?

时间:2018-09-07 11:35:53

标签: android web-applications webview

我有一个具有以下结构的webapp。

repo.head.is_detached

我想要的是滚动Web视图,但是当我在其上绘制画布时,Linearlayout不应滚动。

当我在模拟器中运行该应用程序时,我可以实现它,但是当我在设备上运行该应用程序时,该应用程序会随着Web视图滚动。

因此,当网络视图向下滚动时,我无法在其上绘图。

我该如何解决?

1 个答案:

答案 0 :(得分:0)

<LinearLayout>标记的内部拉出<Webview>标记,并将其放在外部。
像这样:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <WebView
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:gravity="center">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" />
    </LinearLayout>

</RelativeLayout>

但是,如果您在用户界面中有其他含义,请绘制它并将其附加到问题上。