android - Glide + CollapsingToolbarLayout strange behavior -
i'm facing strange behavior when using collapsingtoolbarlayout, toolbar , imageview embedded. here code :
<android.support.design.widget.appbarlayout android:id="@+id/bla" android:layout_width="match_parent" android:layout_height="256dp"> <android.support.design.widget.collapsingtoolbarlayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@color/md_white_1000" android:minheight="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.dark" app:theme="@style/themeoverlay.appcompat.light" /> <imageview android:id="@+id/fragment_kids_profile_pic" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout>
and glide builder:
glide.with(getactivity()) .load(file) .fitcenter() .into(profilepicture);
before setting image via glide, toolbar behavior works exact should, in case "pinned". after setting image, toolbar layout goes missing , image takes place (after scrolling up). pics clarify:
any appreciated !
that happens because collapsingtoolbarlayout
extends framelayout
. in framelayout
last view in view hierarchy 1 on top (if haven't changed in code), it's normal imageview
covers toolbar
. solve "issue" have change order:
<android.support.design.widget.appbarlayout android:id="@+id/bla" android:layout_height="256dp" android:layout_width="match_parent"> <android.support.design.widget.collapsingtoolbarlayout android:layout_height="match_parent" android:layout_width="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:id="@+id/fragment_kids_profile_pic" android:layout_height="match_parent" android:layout_width="match_parent" android:scaletype="centercrop" /> <android.support.v7.widget.toolbar android:background="@color/md_white_1000" android:id="@+id/toolbar" android:layout_height="?attr/actionbarsize" android:layout_width="match_parent" android:minheight="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.dark" app:theme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout>
before set image via glide
imageview
's background transparent, why see toolbar
.
Comments
Post a Comment