首页 > 解决方案 > Webview 不是可滚动的android

问题描述

我在 有一些内容relative layout,并且可以点击,这些内容通过链接和内容imageview隐藏/显示。我有这样的问题:当一个人不隐藏文本和相关布局时,我下面的这个内容可以很容易地上下滚动,但是当这个人隐藏上面的内容时,只能向下滚动而不能向上滚动。我看到了这个问题,但是我的匹配父母并不会引起我认为的任何问题。也许我在另一个地方有问题?textviewrelative layoutwebviewwebviewwebview

这是我的xml模板:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/jobViewLayout"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">


<com.google.android.material.appbar.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:subtitleTextAppearance="@style/Toolbar.SubtitleText"
        app:titleTextAppearance="@style/Toolbar.TitleText" />

</com.google.android.material.appbar.AppBarLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="7dp"
    android:layout_marginTop="7dp"
    android:layout_marginEnd="7dp"
    android:layout_marginBottom="3.5dp"
    android:background="@drawable/old_item">


    <TextView
        android:id="@+id/job_link"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/content_layout"
        android:layout_marginStart="10dp"
        android:layout_marginTop="5dp"
        android:layout_marginEnd="54dp"
        android:ellipsize="end"
        android:singleLine="true"
        android:textColor="@color/gray" />

    <ImageView
        android:id="@+id/hide_content"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_below="@id/content_layout"
        android:layout_alignParentEnd="true"
        android:layout_marginTop="5dp"
        android:layout_marginEnd="10dp"
        android:src="@drawable/ic_up_arrow"
        android:contentDescription="hide btn" />

</RelativeLayout>


<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android:id="@+id/swipeContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginStart="7dp"
    android:layout_marginTop="3.5dp"
    android:layout_marginEnd="7dp"
    android:layout_marginBottom="7dp"
    android:labelFor="@id/swipeContainer"
    android:background="@color/white"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <my_package.jobAGENT.adapters.LollipopFixedWebView
        android:id="@+id/webView"
        android:labelFor="@id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

标签: androidandroid-webview

解决方案


你为什么用那个<de.jobnetzwerk.jobnet.jobAGENT.adapters.LollipopFixedWebView/>

改为使用WebView它会正常工作

<WebView
    android:id="@+id/webView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

推荐阅读