Pau*_*rse 7 android scroll webview android-recyclerview
我有一个 Webview 在我的应用程序中加载静态 html 内容。
问题是,当我单击链接或嵌入内容(推文、youtube 视频)时,网络视图会滚动回顶部。
它看起来像这里提到的 JS 问题
我尝试使用 NestedScrollView 或一些带有参数的技巧,例如
android:focusableInTouchMode="true"
在 LinearLayout 父级中,但没有任何效果
这是我的 xml :
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/article_webview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
它将在回收商视图中。
我的问题是:
有没有办法在 webview 设置或 xml 中防止这种行为?
谢谢 !
我一直有同样的问题。我的WebView也在里面RecyclerView。
当我添加android:descendantFocusability="blocksDescendants"到 my 时RecyclerView,问题不再发生在我身上。
<androidx.recyclerview.widget.RecyclerView
android:descendantFocusability="blocksDescendants"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
955 次 |
| 最近记录: |