简体   繁体   English

Android主页按钮按下区域

[英]Android home button press area

I have this strange issue with the press area for the android up button i am setting the home as up like this 我对android向上按钮的按下区域有这个奇怪的问题,我正在像这样设置房屋

getActionBar().setDisplayHomeAsUpEnabled(true);

and i have 2 Samsung Galaxy Nexus on one of the devices the home button clickable area includes both the icon and the text. 我在其中一台设备上有2个Samsung Galaxy Nexus,主屏幕按钮的可单击区域包括图标和文本。 While on the other device only the icon is included in the clickable area? 在另一台设备上,可点击区域中仅包含图标吗? why is this? 为什么是这样? how can i get the text and the icon to always be included in the clickable area? 我如何才能使文本和图标始终包含在可点击区域中?

Note on the tablet i have the home button clickable area is both the text and the icon. 请注意,在平板电脑上,我具有主页按钮的可单击区域是文本和图标。

In order to cover both cases, you might just need to add the following into your menu selection to be sure that it is covered. 为了涵盖这两种情况,您可能只需要在菜单选项中添加以下内容,以确保将其覆盖。

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        //Manually go up with a call.
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM