Jacksonkr
Jacksonkr

Reputation: 32207

Android Webview examping inside of scrollview / cannot scroll

Problem:

The scroll bar shows up for a SPLIT second then it's gone. I can change the ScrollView's height to 100dp and in the small little box I can scroll.

In the Android Device Monitor I can see that both elements are 1920 in height. It seems as though the webview is somehow pushing everything else to break their match_parent rules because they are acting more like wrap_content. What's going on here?

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

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <WebView
            android:id="@+id/speakerBioWebView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="1000dp"></WebView>

    </ScrollView>

</LinearLayout>

Solution

I noticed that Android Studio was voicing a faint warning about my setup. The warning showed as a faint red line underneath the WebView's layout_height attribute. I changed the it to match_parent and took the outside ScrollView off.

This really was an error is oversight because the warning was not getting my attention at all. Make sure you look at all your compiler / IDE warnings to see if there are any helpful notices.

Upvotes: 0

Views: 932

Answers (1)

mjstam
mjstam

Reputation: 1079

Not sure why you want a scroll view around a WebView as WebView has its own scroll bar.

Upvotes: 1

Related Questions