Добавить вид в конце прокрутки webview Android - PullRequest
0 голосов
/ 20 января 2020

Я хочу добавить пользовательское представление в конце прокрутки веб-просмотра, поэтому, когда пользователь достигает конца веб-просмотра, он может видеть пользовательское представление. Как этого достичь в Android?

  <ScrollView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:fillViewport="true">


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

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

                <com.app.util.CustomView
                    android:visibility="visible"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </LinearLayout>
        </ScrollView>

Я попытался поместить пользовательский вид внизу и в прокрутку, но не сработал, между веб-обзором и моим пользовательским видом есть большая пустая область

enter image description here

РЕДАКТИРОВАТЬ

Я пробовал вложенную прокрутку, но все еще не работает, для этого URL "https://vimeo.com/171614342#embed"это выглядит так

enter image description here Я не вижу нижний колонтитул страницы или раздел комментариев. вот код для вложенной прокрутки

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

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

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@android:color/white"
            android:padding="10dp"
            android:background="@android:color/holo_red_dark"
            android:text="Hello World!" />
    </LinearLayout>

</androidx.core.widget.NestedScrollView>

1 Ответ

0 голосов
/ 20 января 2020

Оберните компоненты внутри NestedScrollView вместо ScrollView . См. Приведенный ниже фрагмент.

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

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

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@android:color/white"
            android:padding="10dp"
            android:background="@android:color/holo_red_dark"
            android:text="Hello World!" />
    </LinearLayout>

</androidx.core.widget.NestedScrollView>

Также проверьте скриншот. enter image description here

Надеюсь, вы получили решение ..

...