How to remove white underline in a SearchView widget in Toolbar Android

Just add this line if you are using a v7 or androidx widget

app:queryBackground="@android:color/transparent"

If you are using SearchView then use for API below 21

android:queryBackground="@android:color/transparent"

you can use below code if you are using API 21 or more

app:queryBackground="@android:color/transparent"

Once try as follows

View v = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
v.setBackgroundColor(Color.parseColor("here give actionbar color code"));

Hope this will helps you.