首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何通过点击physical menuKey展开ActionBar菜单?

如何通过点击physical menuKey展开ActionBar菜单?
EN

Stack Overflow用户
提问于 2015-02-03 20:09:19
回答 1查看 105关注 0票数 0

因此,这是xml文件结构:sfsafsadfsdfasdfasdfasdfasdfsdfsd

代码语言:javascript
复制
 <item...>
    <menu>
       <item>
       </item>
       <item>
       </item>
       <item>
       </item>
   </menu>
  </item>
EN

回答 1

Stack Overflow用户

发布于 2015-02-03 20:31:56

试试这个..。

代码语言:javascript
复制
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}



 @Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        //do your stuff here..
        return true;
    } 
    return super.onOptionsItemSelected(item);
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28298557

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档