android - WebView in CoordinatorLayout with CollapsingToolbarLayout -
i'd add webview in coordinatorlayout, having collapsingtoolbarlayout in appbarlayout. problem webview shrinks in height , doesn't fill space below toolbar, making not usable. tried use webview child of nestedscrollview: doesn't work (it shrinks webview in height), scrolling shrinked webview makes fill viewport.
here layout used:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout android:id="@+id/main_content" 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" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="256dp" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginend="64dp" app:expandedtitlemarginstart="48dp" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" android:scaletype="centercrop" app:layout_collapsemode="parallax" /> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v4.widget.nestedscrollview android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <webview android:id="@+id/article" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v4.widget.nestedscrollview> </android.support.design.widget.coordinatorlayout>
you can use android:fillviewport="true" nestedscrollview , layout_height="wrap_content" webview
Comments
Post a Comment