Я использую ConstraintLayout
требуется, чтобы скрыть ActionBar
, когда пользователь прокручивает в NestedScrollView
. Я получил это от здесь
Это чудесно работает, НО ... У меня есть кнопка Back to Top
в нижней части вида прокрутки, когда я нажимаю, что я вызываю .scrollTo(0,0)
. Проблема в том, что ActionBar
не анимирован, если его не видно.
Как я могу вызвать его движение назад?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_offer_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways|snap" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/layout_offer_detail_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorBackground"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
// .................
<!--BACK TO TOP-->
<TextView
android:id="@+id/tvBackToTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/containerSections"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/ic_back_to_top"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:paddingLeft="@dimen/form_margin"
android:paddingTop="@dimen/field_margin"
android:paddingRight="@dimen/form_margin"
android:paddingBottom="@dimen/form_margin"
android:text="@string/offer_details_back_to_top"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
<ie.xxxx.xxxx.controls.ProgressView
android:id="@+id/layout_progress"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>