【问题标题】:Webview isn't scrollable androidWebview 不是可滚动的android
【发布时间】:2019-11-27 17:57:22
【问题描述】:

我在relative layout 有一些内容,可点击的imageview 隐藏/显示带有链接的textview 和带有内容的relative layout。我有这样的问题:当一个人不隐藏文本和相关布局时,我的 webview 在此内容下方可以轻松上下滚动,但是当此人隐藏 webview 上方的内容时,只能向下滚动并且可以' t 向上滚动。我看到this 问题,但我的webview 匹配父级,我认为它不会引起任何问题。也许我在其他地方有问题?

这是我的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>

【问题讨论】:

    标签: android android-webview


    【解决方案1】:

    你为什么要使用&lt;de.jobnetzwerk.jobnet.jobAGENT.adapters.LollipopFixedWebView/&gt;

    改用WebView,它会正常工作

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

    【讨论】:

    • 因为这是支持android 5.0的自定义webview客户端
    猜你喜欢
    • 1970-01-01
    • 2011-09-09
    • 2022-01-22
    • 2012-11-07
    • 2017-05-11
    • 1970-01-01
    • 2015-12-10
    • 2019-04-25
    • 1970-01-01
    相关资源
    最近更新 更多