I implemented CoordinatorLayout.Behavior
and overridden onDependentViewChanged
function but it worries me it fires every couple milliseconds even the scroll view is staying still.
That doesn't change if I return false from onDependentViewChanged
I can't find any information on this, but this thing spamming my logs doesn't look like a proper behavior. Will drain the battery.
My simplified layout look like this:
<SwipeRefreshLayout
android:id="@+id/ptr"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.widget.NestedScrollView>
<FrameLayout
android:id="@+id/avatarContainer"
android:layout_width="20dp"
android:layout_height="20dp"
app:layout_anchor="@id/scrollView"
app:layout_anchorGravity="center_horizontal|top"
app:layout_behavior="my.app.behaviors.ProfileAvatarBehavior">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
</SwipeRefreshLayout>
Apparently I didn't do as stated with returning false. Key was to return false if no changes are going to be made and not doing anything with view. What I did was resizing some views anyway (even the params were the same) and then returned false. This resulted in chain calls