如何停止线性布局以使用webview滚动?

问题描述 投票:0回答:1

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

<RelativeLayout>
  <Webview>
    <LinearLayout>
      <Button>

我想要的是滚动webview,但是当我在它上面绘制画布时,Linearlayout不应该滚动。

当我在模拟器中运行应用程序时,我可以实现它,但当我在设备上运行它时,相同的应用程序,布局与webview滚动。

因此,当webview向下滚动时,我无法绘制它。

我怎么解决这个问题?

android web-applications webview
1个回答
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>

但如果您在UI中表示其他内容,请绘制并将其附加到问题中。

© www.soinside.com 2019 - 2024. All rights reserved.