我的代码使用工具栏
我尝试使用How To show icons in Overflow menu in ActionBar
但没有工作
android:minSdkVersion="14"
android:targetSdkVersion="22"
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setLogo(R.drawable.ic_launcher);
setSupportActionBar(toolbar);
for(int i=0; i < NavDrawerArray.length; i++) {
switch (i) {
case 0:
icon = R.drawable.ic_action_dock;
break;
case 1:
icon = R.drawable.ic_action_time;
break;
case 2:
icon = R.drawable.ic_action_share_nav;
break;
case 3:
icon = R.drawable.ic_action_important;
break;
case 4:
icon = R.drawable.ic_action_about;
break;
case 5:
icon = R.drawable.ic_minimize;
break;
case 6:
icon = R.drawable.ic_action_cancel;
break;
default:
break;
}
menu.add(Menu.NONE, i, Menu.NONE, NavDrawerArray[i]).setIcon(icon);
}
return super.onCreateOptionsMenu(menu);