I have added search icon in menu folder and created menu.xml
file for that. Here I created custom search icon with light green color from Android Image Asset.
When I added this light green color search icon in drawable and run the project, it coming with white color. And search hint and search text also coming in white. Since I have white action bar, these all search icons are not at all visible. Please help to correct this.
I have created a menu.xml file for search icon and also added search icon with light green color in drawable folders. I am using Theme.AppCompat.Light.DarkActionBar and my action bar color it set it to white.
Styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="titleTextColor">@color/titleColor</item>
<item name="colorControlNormal">@color/colorAccent</item>
menu.xml file :
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView"
android:title="@string/search_string" />
<!--<item
android:id="@+id/action_settings"
android:title="Settings"/>-->
</menu>
Activity code :
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
MenuItem item = menu.findItem(R.id.action_search);
//additonal code
return super.onCreateOptionsMenu(menu);
I want custom color search icon only to be displayed in white action bar instead of white color search icon(now displaying). And search query search hint in black color. Please help...