I have a collapsing toolbar within an appbar layout. It contains a view pager as it's collapsing content and a pinned action toolbar. The activity also has a nested scroll view below the collapsing toolbar. The nested scroll view contains a google map fragment.
On start of the activity, the collapsing toolbar collapses automatically in some of the cases without programmatically collapsing it.
I have tried a combination of different scroll flags for my view with scroll|exitUntilCollapsed|enterAlways. I have also tried not showing the google map fragment but I can still reproduce it.
How can I stop it from collapsing automatically? Any help would be appreciated!
I know its late but still..
The reason collapsing toolbar automatically collapses on actvity start is because there may a view in < include layout="@layout/content_scrolling" /> like edittext which gain its focus when activity is started..
To overcome this issue you can add the tag
android:focusableInTouchMode="true"
to or
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
xmlns:android="http://schemas.android.com/apk/res/android">
Hope it helps..:)
Happy Coding..:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.