Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我实现了一个从右到左打开的侧抽屉。现在我想用另一个图标替换默认菜单图标(3 个点)。
如果单击“新图标”,则应打开侧抽屉。
我无法让它工作,需要一些帮助。提前致谢。
只需在菜单中添加一个项目showAsAction="always"并设置您想要的图标,然后添加以下代码onOptionsItemSelected
showAsAction="always"
onOptionsItemSelected
@Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId()==R.id.your item id){ drawer.open(); } }