Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

2.0.0-beta3 Visibility of view to GONE also hides WebView underneath #78

Open
Onlinedispatcher opened this issue Nov 18, 2019 · 0 comments

Comments

@Onlinedispatcher
Copy link

Onlinedispatcher commented Nov 18, 2019

Currently:
We a ConstraintLayout with a webview and a image view. The image view is directly laying over the webview, in order to show a placeholder image, until the webview has finished loading:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:background="@color/blue_10"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/webview_mask"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:background="@color/blue_10"
        android:src="@drawable/loading_image"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

As soon as the webview has finished loading, the visibility of webview_mask is set to GONE.

private WebViewClient createWebViewClient() {
        return new WebViewClient() {
            public void onPageFinished(WebView view, String url) {
                mWebViewMask.setVisibility(View.GONE);
            }
        };
    }

Expected:
With constraintLayout 1.1.3 this is working without any issues. With 2.0.0-beta3 setting the visibility of the mWebViewMask to GONE, also sets height and weight of the webview underneath to 0.
Remark: By setting the visibility to INVISIBLE instead of GONE, the webview below is visible again. But this should also work with GONE, as the webview is still there.

@Onlinedispatcher Onlinedispatcher changed the title 2.0.0-beta3 2.0.0-beta3 Visibility of View to GONE also hides WebView underneath Nov 18, 2019
@Onlinedispatcher Onlinedispatcher changed the title 2.0.0-beta3 Visibility of View to GONE also hides WebView underneath 2.0.0-beta3 Visibility of view to GONE also hides WebView underneath Nov 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant