MaterialSearchView icon indicating copy to clipboard operation
MaterialSearchView copied to clipboard

CoordinatorLayout and Suggestions

Open farazappy opened this issue 7 years ago • 10 comments

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.

farazappy avatar Apr 14 '17 21:04 farazappy

I have the same problem

wang9090980 avatar Apr 17 '17 17:04 wang9090980

My suggestions are not showing at all.

My hierarchy is as follows.

  • DrawerLayout
    • CoordinatorLayout
      • AppBarLayout
        • Toolbar
        • MaterialSearchView

adam-hurwitz avatar Apr 20 '17 19:04 adam-hurwitz

Adam, try using a frame layout. Fara try putting some stuff on onQuerySubmit, you have full control over what happens using that.

RRethy avatar Apr 20 '17 22:04 RRethy

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
screen shot 2017-04-21 at 2 13 59 pm screen shot 2017-04-21 at 2 14 53 pm

adam-hurwitz avatar Apr 21 '17 21:04 adam-hurwitz

I have same problem of @AdamSHurwitz. can everyone fix that?

congdanh1608 avatar Jul 08 '17 06:07 congdanh1608

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 avatar Jul 15 '17 13:07 rana01645

@rana01645 , thank you so much about your solution. :)

congdanh1608 avatar Jul 24 '17 09:07 congdanh1608

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.

shriyanshgautam avatar Sep 01 '17 12:09 shriyanshgautam

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???

programmer1058 avatar Aug 14 '18 14:08 programmer1058

@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>

ARXII-13 avatar Aug 01 '19 17:08 ARXII-13