难道Android应用程序开发指南允许禁用默认菜单和特定的应用后退按钮? [英] Does Android application development Guideline allow disabling Default Menu and back button for particular application?

查看:304
本文介绍了难道Android应用程序开发指南允许禁用默认菜单和特定的应用后退按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序有一些按钮,非常接近到该设备的默认回键和菜单键。
因此,我虽然pressing的问题,我的应用程序按钮,这是附近的菜单和返回按钮。

因此​​,对于应用目的我想禁用默认的后退和菜单按钮。

因此​​,没有Android应用程序开发指南允许,如果我们想禁止特定的应用程序中的后退和菜单按钮?
如果是的话怎么可能?

感谢。


解决方案

  

那么,Android应用程序开发指南允许,如果我们要禁用perticular应用过程中的后退和菜单按钮?


节目的任何操作系统的指导方针(在Windows,Mac,iOS版,Android版等)的不破的默认行为

一个用户会希望您的应用程序支持他/她正在使用的设备,并在大多数情况下,买了设备正是由于这个原因默认行为:他/她喜欢的默认行为。如果他/她想要的另一种类型的用户交互,他/她会买其他类型的设备。


  

在我的应用程序有一些按钮,非常接近到该设备的默认回键和菜单键


只要你的按钮显示在屏幕上,我看不出它如何能成为一个问题。然而,如果它以某种方式出了问题,不是覆盖默认行为是为移动放大您的按钮,使它更容易为用户打他们。


  

如果是的话那么它是如何可能的?


是的,是可以做到的。

要禁用后退按钮,只需重写 onBack pressed()中的任何活动出现问题并留下它的implementaion空的:

 公共无效onBack pressed(){
   //没做什么
}

菜单按钮只会是一个问题ifyou从活动膨胀的菜单。标准行为是,当你点击菜单按钮,只要你不告诉你的活动做点什么什么都不会发生。

In my application there are some buttons that are very near to that device default back button and Menu Button. Thus I got problem while pressing that My application button which are near to Menu and Back button.

So for that application purpose I want to disable the default back and Menu Button.

So does Android Application development Guideline allow if we want to disable the back and Menu Button during particular application? If yes then how is it possible?

Thanks.

解决方案

So is Android Application development Guideline allow if we want to disable the back and Menu Button during perticular application?

The guideline of programming for any OS (Windows, Mac, iOS, Android etc.) is don't break the default behaviour.

A user will expect that your App supports the default behaviour of the device he/she is using and in most cases bought the device for that very reason: He/she enjoys the default behaviour. If he/she wanted another type of user interaction, he/she would have bought another type of device.

In my application there are some buttons that are very near to that device default back button and Menu Button

As long as your button is on the screen, I don't see how it can become a problem. If however it in someway is a problem, a better solution than overriding default behaviour is to move or enlarge your buttons to make it easier for the user to hit them.

If yes then how it is possible?

Yes, it can be done.

To disable the back button, simply override onBackPressed() in whatever Activity the problem occurs and leave the implementaion of it empty:

public void onBackPressed() {
   //Do nothing
}

The Menu Button will only be a problem ifyou inflate a menu from your Activity. Standard behaviour is that nothing happens when you hit the Menu Button as long as you don't tell your Activity to do something.

这篇关于难道Android应用程序开发指南允许禁用默认菜单和特定的应用后退按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆