FloatingSearchView浮动搜索视图

联合创作 · 2023-09-24 09:31

FloatingSearchView 是浮动搜索视图,实现了一个浮动的搜索框和搜索建议。

Alt text

    <com.arlib.floatingsearchview.FloatingSearchView
               android:id="@+id/floating_search_view"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               app:floatingSearch_searchBarMarginLeft="@dimen/search_view_inset"
               app:floatingSearch_searchBarMarginTop="@dimen/search_view_inset"
               app:floatingSearch_searchBarMarginRight="@dimen/search_view_inset"
               app:floatingSearch_showMenuAction="true"
               app:floatingSearch_searchHint="Search..."
               app:floatingSearch_voiceRecHint="Say something..."
               app:floatingSearch_showSearchHintWhenNotFocused="true"
               app:floatingSearch_showVoiceInput="true"
               app:floatingSearch_showOverFlowMenu="true"
               app:floatingSearch_hideOverflowMenuWhenFocused="true"
               app:floatingSearch_showSearchKey="false"
               app:floatingSearch_dismissOnOutsideTouch="true"
               app:floatingSearch_menu="@menu/menu_main"/>
  mSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
              @Override
              public void onSearchTextChanged(String oldQuery, final String newQuery) {

                  //get suggestions based on newQuery

                  //pass them on to the search view
                  mSearchView.swapSuggestions(newSuggestions);
              }
          });

 

浏览 3
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报