将此段代码放到Acitivity
@SuppressLint("RestrictedApi")
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
if (menu is MenuBuilder) {
menu.setOptionalIconsVisible(true)
}
menuInflater.inflate(R.menu.menu_main, menu) //如果setSupportActionBar()了就删掉此行
return super.onCreateOptionsMenu(menu)
}
标签:onCreateOptionsMenu,工具栏,Menu,menu,Android,Icon
From: https://www.cnblogs.com/jing332/p/16877382.html