我正在尝试使用浮动搜索视图来实现此行为,其中NestedScrollView在应用栏布局下滚动。
我目前所拥有的是滚动视图位于appbarlayout下方的位置:
一些代码:
<android.support.design.widget.AppBarLayout android:layout_width="match_parent"
android:layout_height="@dimen/appbar_home"
android:background="@null"
app:elevation="0dp">
<com.arlib.floatingsearchview.FloatingSearchView android:id="@+id/floating_search_view"
style="@style/SearchView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:floatingSearch_searchBarMarginLeft="@dimen/content_spacing"
app:floatingSearch_searchBarMarginRight="@dimen/content_spacing"
app:floatingSearch_searchBarMarginTop="32dp"
app:floatingSearch_close_search_on_keyboard_dismiss="true"
app:floatingSearch_leftActionMode="showSearch"
app:floatingSearch_menu="@menu/menu_home"
app:floatingSearch_searchHint="Search..."
app:floatingSearch_showSearchKey="false"
app:floatingSearch_suggestionsListAnimDuration="250"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/test"/>
</FrameLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>