I have a search widget in my Action Bar like this:
(1) How do I change
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
// Associate search configuration with the SearchView
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView =
(SearchView) menu.findItem(R.id.search).getActionView();
searchView.setQueryHint("Client/DOB/PPSN");
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
// Setting the textview default behaviour properties
int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView = (TextView) searchView.findViewById(id);
textView.setTextColor(Color.WHITE);
textView.setHintTextColor(Color.WHITE);
// Set the search plate color to white
int linlayId = getResources().getIdentifier("android:id/search_plate", null, null);
View view = searchView.findViewById(linlayId);
Drawable drawColor = getResources().getDrawable(R.drawable.searchcolor);
view.setBackground( drawColor );
return super.onCreateOptionsMenu(menu);
}
Now this is the xml file searchcolor.xml for changing the plate color of search bar
-
-
-
and menu/menu.xml for creating the search in action bar