我正在使用导航抽屉,并且我在所有片段中都有操作栏,我试图在操作栏中添加搜索图标,但未显示,应用程序未崩溃,但即使图标在我的操作栏中也不可见,以下是我的该代码任何一个可以帮助如何在操作栏中添加搜索图标?
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:icon="@drawable/searchs"
android:title="@string/action_settings"/>
</menu>
MainActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
看到此链接http://stackoverflow.com/questions/30566886/searchview-in-actionbar-appcompat/30566958#30566958 –