D. Math
D. Math

Reputation: 329

SearchView with rounded corners in ActionBar

I am working on an app needing a SearchView in the search fragment.

I obviously know how to create a classic SearchView, but how is it possible to customize it to get a result like this :

enter image description here

Upvotes: 1

Views: 2897

Answers (1)

user6448973
user6448973

Reputation:

Use CardViewto wrap the SearchView

enter image description here

  <android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    app:cardBackgroundColor="@android:color/darker_gray"
    app:cardCornerRadius="5dp"
    app:cardUseCompatPadding="true">

    <android.support.v7.widget.SearchView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

Upvotes: 8

Related Questions