How can I change the offset of the AppBarLayout programmatically?
I want a certain offset to the AppBarLayout(partially expanded) when the Activity first loads, then
Use this: ScrollableAppBar
You just have to replace your AppBarLayout
with:
<it.michelelacorte.scrollableappbar.ScrollableAppBar
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="380dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
</it.michelelacorte.scrollableappbar.ScrollableAppBar>
and than:
ScrollableAppBar appBarLayout = (ScrollableAppBar) findViewById(R.id.appbar);
//To give the effect "in the middle" of the image (like gif)
appBarLayout.collapseToolbar();
Output: