I have an AppBar and a horizontal linearlayout (which includes an edit text and two imagebuttons) and other things in my layout. When user scrolls down,
Actually, that design seems to be wrong.Why? let me explain that to you.
Except those xmlns:android="http://schemas.android.com/apk/res/android" which it wasn't necessary or using: android:layout_alignParentTop="true" in the LinearLayout or using that ScrollView under the contents or etc, seems like you don't have any idea what's going on.(no problem).
Note: the most important thing was, adding:
app:layout_behavior="@string/appbar_scrolling_view_behavior" which also mentioned here:
http://guides.codepath.com/android/Handling-Scrolls-with-CoordinatorLayout
And this flag should hide that section:(exitUntilCollapsed)
app:layout_scrollFlags="scroll|exitUntilCollapsed"
exitUntilCollapsed:When the scroll flag is set, scrolling down will normally cause the entire content to move.
So finally: http://i.stack.imgur.com/qf1So.gif
Hope this is what you were looking for, if it wasn't please edit your question and add some screenshots.
Feel free to change the flags or add a new to achieve what you exactly need.
UPDATE:
If you want to hide that Toolbar(red section) after collapsing, just use this in the CollapsingToolbarLayout:
app:layout_scrollFlags="scroll|snap"
Finally, you will get the same result(something like googleplay design).
Codes:
Results: after collapsing, the searchedittext won't hide:
UPDATE: New way :)
Results: