Android <include layout inside NestedScrollView -
i have coordinatorlayout nestedscrollview. trying include layout inside nestedscrollview however, layout assumes can overlap collaping toolbar. have searched on , not find solution problem. tried including fragment directly instead of layout. failed too. tried including simple textview inside nestedscrollview - worked. problem in include. please me solve it.
doesn't work
<android.support.v4.widget.nestedscrollview android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <include layout="@layout/content_detail"/> </android.support.v4.widget.nestedscrollview>
does work
<android.support.v4.widget.nestedscrollview android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello, working text"/> </android.support.v4.widget.nestedscrollview>
full layout
<?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:id="@+id/detail_container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.jennyeckstein.udacitycoursepicker.detailactivity" android:background="#d82a2a"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#292c65"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollflags="scroll|exituntilcollapsed" app:expandedtitlemarginstart="50dp" android:background="#78df49"> <framelayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_collapsemode="parallax" app:contentinsetstart="50dp" android:background="#2cb27c"> <imageview android:id="@+id/detail_course_image_appbarlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop" tools:src="@drawable/course_test_image" app:layout_collapsemode="parallax" app:layout_scrollflags="scroll|enteralways" /> <view android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/scrim"/> </framelayout> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" android:background="@color/coloraccent" > </android.support.v7.widget.toolbar> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v4.widget.nestedscrollview android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <!--<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello, working text"/>--> <include layout="@layout/content_detail" /> </android.support.v4.widget.nestedscrollview> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" /> </android.support.design.widget.coordinatorlayout>
yes, kind of layout , codes automatically generated if choose basicactivity. can set text (contents) in /res/layout/content_detail
, not in mainactivity 's layout.
Comments
Post a Comment