Vineeth Mohan
Vineeth Mohan

Reputation: 2864

Add submit button to SearchView

I tried to implement a SearchView in ToolBar. When I try to use this option to submit my query, the submit button is located inside the ToolBar. However, I need the button inside the SearchView.

How can I customise the SearchView?

Upvotes: 4

Views: 1597

Answers (2)

madhu527
madhu527

Reputation: 4782

Android SearchView customisation

 <android.support.v7.widget.SearchView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/colorAsh"
    android:backgroundTint="@color/colorAsh"
    android:searchIcon="@drawable/ic_search"
    android:commitIcon="@drawable/ic_commit"
    android:searchHintIcon="@drawable/ic_search" 
    android:closeIcon="@drawable/ic_close" 
    android:goIcon="@drawable/ic_go">

</android.support.v7.widget.SearchView>

Dont forget to change these icons.

And follow this SearchView to know each option of SearchView .

Upvotes: 1

karan
karan

Reputation: 8853

Use searchView.setSubmitButtonEnabled(true).

This will show default search submit button inside searchview.

Upvotes: 6

Related Questions