As a developer, do I have access to android's default search icon? I am referring to the one that comes with the SearchView? Is there a way to access it as I might, for instance, access any drawable that I own? One of the ways I intend to use it is to add it to an AutoCompleteTextView, as I might to any other TextView.
The search icon is included in the action bar icon package . It has both light and dark versions of it as do all the other icons found there.
Not sure if older android versions use a different icon but you could make sure that they are the same by setting the icon yourself with something like:
getMenuInflater().inflate(R.menu.actionbar_items, menu);
SearchView searchView = menu.findItem(R.id.action_search).getActionView();
int resId = getResources().getIdentifier("search_button", "id", "android");
ImageView searchIcon = (ImageView) mSesearchViewrchView.findViewById(resId);
Some of them are available via:
android.R.drawable.bla-bla-bla - from runtime
@android.drawable.bla-bla-bla - from xml
Or download all icons from: https://developer.android.com/design/downloads/index.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.