since google has published design support library android, there many nice things can done without implementing custom code. while i've tested custom views in lib, have found worse thing, , didn't know if bug or not.
i have found cheesesquare project on github. in activity_detail.xml(layout file) there 3 cardviews inside nestedscrollview. if delete 2 of them, can see nestedscrollview doesn't have full size of parent(match_parent). nestedscrollview bound bottom of parent view. http://i.stack.imgur.com/bxl7w.png
the nestedscrollview get's full size when remove app:layout_behavior="@string/appbar_scrolling_view_behavior"
.
but when remove layout behavior, toolbar not collapsing.
is there fix this? example layout file can found here: https://github.com/smove/cheesesquare/blob/stackoverflow/app/src/main/res/layout/activity_detail.xml
you can build cheesesquare apk github branch stackoverflow
i had problem , fixed adding:
android:layout_gravity="fill_vertical"
to nestedscrollview. starts behaving correctly, explained here also. of course nestedscrollview needs kind of child (i.e. must not empty), otherwise toolbar won't collapse.
update
while works well small content, noticed has problems showing longer contents, e.g. full activity_detail.xml
above. problem can't scroll bottom part of content - unreachable @ bottom.
from tests find missing part as big collapsed toolbar (or @ least that's looks me). fix issue, , having solution reliable both small , big contents, should add layout_marginbottom
scrollview, gets measured , releases missing bottom part. thus:
android:layout_gravity="fill_vertical" android:layout_marginbottom="?attr/actionbarsize"
or whatever size gave toolbar
.
but still
scrolling small contents solution, if content justly aligned @ top, isn't smooth scrolling large contents. i'll use until library fix comes.
update2
looks fixed in v22.2.1 .
Comments
Post a Comment