How To Change The Icon Color Of Search View
Anyone help me i want to change the default icon color of search view.i want to open the search item in this activity and get the result in another activity.I am using android.supp
Solution 1:
For Lollipop and above versions place the below code in onCreateOptionsMenu() before return statement
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
ImageView searchButton = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_button);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
searchButton.setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.yourDesiredColor)));
}
might be useful for someone.
Solution 2:
Add This as Your Menu Item
android:icon="@drawable/search"
Post a Comment for "How To Change The Icon Color Of Search View"