0

I want to make a searchview with rounded bordered for my android application. So far i made rounded border with white background but search icon and cancel icon disappear and no text showing when type. i have changed icon color to black and text color to black nothing shows.

how can i achieve that like image here https://i.stack.imgur.com/ZJTdA.jpg

So far here is my code

searchview_rounded.xml

<?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff"/>
<corners android:radius="30dp"/>
<padding android:left="30dp"
    android:bottom="30dp"
    android:right="30dp"
    android:top="30dp"/>
  </shape>

layout

    <SearchView
            android:id="@+id/searchView"
            android:padding="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:iconifiedByDefault="false"
            android:queryHint="Search"
            android:layout_centerHorizontal="true"
            android:background="@drawable/sechview_rounded"
            />
ankuranurag2
  • 2,300
  • 15
  • 30
shakac
  • 379
  • 4
  • 15
  • see if it can help https://stackoverflow.com/questions/32796955/android-custom-searchview-rounded-corners – SAKhan Feb 07 '19 at 10:06
  • Check this out https://stackoverflow.com/questions/16161448/how-to-make-layout-with-rounded-corners – MRX Feb 07 '19 at 10:06
  • Above code is correct and is working, your problem comes from somewhere else. Maybe your could try to change your theme by adding different items : https://stackoverflow.com/a/26897024/7871886 – Yogi Bear Feb 07 '19 at 10:21
  • have you try by changing rounded corner drawable color? – mitesh makwana Feb 07 '19 at 11:12

1 Answers1

0

Replace your searchView to below snippet, use android:queryBackground="@android:color/transparent" for hiding underline below the searchView, for detail Link

 <SearchView
                android:id="@+id/searchView"
                android:padding="5dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:iconifiedByDefault="false"
                android:queryHint="Search"
                android:layout_centerHorizontal="true"
                android:background="@drawable/sechview_rounded"
                android:queryBackground="@android:color/transparent"
                />
Fahad Ali
  • 55
  • 8