MaterialSearchView
MaterialSearchView copied to clipboard
CoordinatorLayout and Suggestions
Coordinator Layout and Suggestions don't seem to work together, Only a single suggestions comes in the list view! Also how can I execute the search directly when a suggestion is clicked? Can we have some other functions like clicking a suggestion would take the user somewhere instead of executing the search?
Currently I tried touching a suggestion but all it does is auto completes the search field with the suggestion text.
I have the same problem
My suggestions are not showing at all.
My hierarchy is as follows.
-
DrawerLayout
-
CoordinatorLayout
-
AppBarLayout
- Toolbar
- MaterialSearchView
-
AppBarLayout
-
CoordinatorLayout
Adam, try using a frame layout. Fara try putting some stuff on onQuerySubmit, you have full control over what happens using that.
The issue appears to be with the CollapsingToolbarLayout. Interchanging the CoordinatorLayout with a FrameLayout does not have an effect on the UI.
For some reason part of the Toolbar or CollapsingToolbarLayout are expanding to the entire view blocking the content on the screen. When I remove the MaterialSearchView the Toolbar and content appear as expected.
- DrawerLayout
- CoordinatorLayout
- AppBarLayout
- CollapsingToolbarLayout - Toolbar - MaterialSearchView
- AppBarLayout
- CoordinatorLayout


I have same problem of @AdamSHurwitz. can everyone fix that?
I figured out a solution finally.. Which will show more than 1 suggestion with coordinate layout and appbarlayout
Place the searchview outside the CoordinatorLayout and cover the whole CoordinatorLayout with another CoordinatorLayout .... And now it will show whole suggestion ;)
@rana01645 , thank you so much about your solution. :)
Putting MaterialSearchView directly inside CoordinatorLayout but outside AppBarLayout works. Just put elevation of MaterialSearchView higher than others(like Toolbar) to make it visible. The Structure should be: CoordinatorLayout -MaterialSearchView(with higher elevation) -AppBarLayout -Toolbar -Other Views (like ViewPager and FloatingActionButton)
After this all the suggestions will will be visible.
hi guys. when i open searchview the gray layer not show to touch it to close searchView and i must use back button to close it. can anyone help me???
@rana01645 's solution worked out for me. This is how my layout looks like, the MW means android:layout_width="match_parent", android:layout_height="wrap_content":
<CoordinatorLayout (MM)>
<CoordinatorLayout (MM) >
<AppBarLayout (MW)>
<Toolbar (MW)>
</Toolbar>
</AppBarLayout>
<fragment/>
</CoordinatorLayout>
<MaterialSearchView (MW) />
</CoordinatorLayout>