[英]accessing android's SearchView search icon
As a developer, do I have access to android's default search icon? 作为开发人员,我可以访问android的默认搜索图标吗? I am referring to the one that comes with the SearchView?
我指的是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.
我打算使用它的一种方法是将其添加到AutoCompleteTextView中,就像添加到其他任何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: 不知道较早的android版本是否使用其他图标,但是您可以通过自行设置图标来确保它们相同:
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 或从以下位置下载所有图标: https : //developer.android.com/design/downloads/index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.