滚动ListView时无法用动画隐藏ToolBar

时间:2015-11-06 07:48:39

标签: android listview android-toolbar

滚动'UserControl' is a type in 'UI' and cannot be used as an expression. 时,我想隐藏ToolBar。像this

这是我的xml:

ListView

我的代码在<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/tabanim_maincontent" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/actionbar_bg" app:popupTheme="@style/AppTheme.PopupOverlay" app:layout_scrollFlags="scroll|enterAlways" > <Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.v7.widget.Toolbar> </android.support.design.widget.AppBarLayout> <ListView android:id="@+id/list_view" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.design.widget.CoordinatorLayout>

Activity

}

1 个答案:

答案 0 :(得分:2)

link可能会帮助您隐藏工具栏以及FAB