Android ActionBar vom AppCompat中的SearchView图标始终有阴影

Android ActionBar vom AppCompat中的SearchView图标始终有阴影,android,android-actionbar,searchview,android-appcompat,Android,Android Actionbar,Searchview,Android Appcompat,我在AppCompat Actionbar中加入了一个SearchView,但它的图标总是有阴影 对于其他图标,我使用的是没有阴影的图标,实际上我还试图通过android:icon=“@drawable/ic\u action\u search”为SearchView分配一个图标,但这不会改变图标 我的研究表明,实际上,android-support-v7-appcompat.jar中的ab_ic_search.png正在被使用,而我的android:icon=“@drawable/ic_ac

我在AppCompat Actionbar中加入了一个SearchView,但它的图标总是有阴影

对于其他图标,我使用的是没有阴影的图标,实际上我还试图通过
android:icon=“@drawable/ic\u action\u search”
SearchView
分配一个图标,但这不会改变图标

我的研究表明,实际上,
android-support-v7-appcompat.jar
中的
ab_ic_search.png
正在被使用,而我的
android:icon=“@drawable/ic_action_search”
被忽略

我尝试了各种方法,比如尝试替换
onPrepareOptionsMenu
(通过尝试查找
ImageView
)中的图像,或者通过
SearchView
的自定义子类替换图像,但都没有用

有没有办法解决这个问题?基本上,我只想让我的图标统一,我是否必须向所有其他图标添加阴影?也许我无论如何都无法给这三个点添加阴影?

多亏了,我成功构建了我的解决方案:

public boolean onCreateOptionsMenu(Menu menu) {
    // the search view is in the mymenu.xml
    inflater.inflate(R.menu.mymenu, menu);

    // now that it is inflated we can get the item
    MenuItem item = menu.findItem(R.id.action_find);

   // and through it the actionview
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
    Drawable searchIcon = getActivity().getResources().getDrawable(R.drawable.ic_action_search); // the new icon

    // and now we search within the view for the "bad" image
    ImageView collapsedSearchIcon = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_button);

    // and finally replace it
    collapsedSearchIcon.setImageDrawable(searchIcon);
}

要获得ExpandedSearch图标,请使用id android.support.v7.appcompat.R.id.search\u mag\u图标