Home > Software design >  SearchView icon and query text not visible with black background
SearchView icon and query text not visible with black background

Time:10-11

If I set layout background to black, SearchView widget's icon, text and query text are not visible. I have tried to apply a style, but it's not working. I guess the style was for v7 widget.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@ id/activityGiphy"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    android:orientation="vertical"
    tools:context=".presentation.ui.view.GiphyActivity">

    <SearchView
        android:id="@ id/svGiphy"
        style="@style/AppSearchView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="15dp"
        android:layout_marginTop="15dp"
        android:layout_marginBottom="15dp"
        android:background="@drawable/search_shape"
        android:iconifiedByDefault="false"
        android:queryHint="input text" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppSearchView" parent="Widget.AppCompat.Light.SearchView" >
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorHint">@color/white</item>
        <item name="android:tint">@color/colorPrimary</item>
        <item name="android:panelColorForeground">@color/white</item>
    </style>
</resources>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners
        android:radius="16dp"/>
    <stroke
        android:color="@color/white"
        android:width="2dp"/>
</shape>

searchview

  • Related