I have a markup:

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout 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=".ActionsMessages.MessageShow" tools:layout_editor_absoluteY="81dp"> <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="20dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/sender" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="10dp" android:layout_marginEnd="10dp" android:textSize="18sp" /> <TextView android:id="@+id/theme" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="10dp" android:layout_marginEnd="10dp" android:textStyle="bold" /> <TextView android:id="@+id/date_of" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="10dp" android:layout_marginEnd="10dp" /> <TextView android:id="@+id/body" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="20dp" android:layout_marginEnd="10dp" android:layout_marginBottom="10dp" android:scrollbars="vertical" /> <ListView android:id="@+id/list_attachment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="20dp" android:layout_marginEnd="10dp" android:layout_marginBottom="40dp" android:choiceMode="singleChoice" /> </LinearLayout> </ScrollView> <android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="?android:attr/colorPrimary" android:foreground="?attr/selectableItemBackground" app:itemBackground="@color/colorPrimary" app:itemIconTint="@android:color/white" app:itemTextColor="@android:color/white" app:labelVisibilityMode="unlabeled" app:menu="@menu/bottom_navigation_main" /> </android.support.design.widget.CoordinatorLayout> 

and I need to replace this textView with a webView:

  <TextView android:id="@+id/body" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="20dp" android:layout_marginEnd="10dp" android:layout_marginBottom="10dp" android:scrollbars="vertical" /> 

but I can't, because I write:

 Placing a <WebView> in a parent element that uses a wrap_content size can lead to subtle bugs; use match_parent 

I found such a link there is almost the same problem, but I could not do the same as the offer in the answer.

I can not understand how to solve the problem. I hope for your help and useful tips.

PS The markup can be very curve and constructed incorrectly, but I don’t know how to do it anyway.

    1 answer 1

    Simple rule:

    do not put WebView in containers, where at least one of the sizes is specified as wrap_content . In the case of markup containing ScrollView , it is most likely impracticable.

    Get ScrollView of ScrollView , and it can work.

    • and how can I scroll the entire layout without scrolling? - Andrew Goroshko
    • have to choose, or scroll or webview. - Eugene Krivenja
    • Thanks for helping me, I’ll see what is needed more, or get out to get both, and then - Andrew Goroshko