I want to change a border color of my searchview . Right now its coming transparent . I tried giving styling to it but nothing working .
SearchView.xml
<LinearLayout
android:id="@+id/linear1"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<android.support.v7.widget.SearchView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:background="@android:color/white"
android:layout_marginTop="10dp"
style="@style/CitySearchView"
android:layout_weight="0.9"
android:layout_marginLeft="10dp"/>
style.xml
<style name="CitySearchView" parent="Widget.AppCompat.Light.SearchView">
<item name="searchIcon">@drawable/blue_search_bar</item>
<item name="colorControlActivated">@color/labelColorHighligh</item>
<item name="colorControlNormal">@color/backgroud_user</item>
<item name="queryBackground">@color/labelColorHighligh</item>
</style>
Create drawable file background.xml
with this content:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="12dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<stroke
android:width="0.3dp"
android:color="#797979" />
</shape>
Add the drawable to the background:
<android.support.v7.widget.SearchView
android:background="@drawable/background"
android:id="@+id/searchView"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_width="300dp" />