ActionBarCompat - 应用程序图标操作(点击)不工作4.0设备 [英] ActionBarCompat - App icon action (click) not working on 4.0 devices

查看:191
本文介绍了ActionBarCompat - 应用程序图标操作(点击)不工作4.0设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题与的Andr​​oid ActionBarCompat 的项目:在仿真器与Android 4.0的点击在应用程序图标不会造成任何 onOptionsItemSelected 事件,而它适用于所有其他版本的操作系统。

I have this problem with the Android ActionBarCompat project: On emulators with Android 4.0 the click on the app icon doesn't cause any onOptionsItemSelected event, whereas it works on all other OS versions.

任何投入大大AP preciated!

Any input is greatly appreciated!

推荐答案

您看到的应用程序图标的任何触摸的反馈? (是否发光,当你preSS吗?)

Are you seeing any touch feedback from the app icon? (Does it glow when you press it?)

由于许多活动,不使用操作栏home键,在应用程序,针对API 14+在Android 4.0上运行它默认是禁用的。 (这是为了让用户不要试图pressing它,看到它焕发,但不知道为什么什么都没有发生。)希望利用这个应该叫<一个应用程序href="http://developer.android.com/reference/android/app/ActionBar.html#setHomeButtonEnabled%28boolean%29"><$c$c>ActionBar#setHomeButtonEnabled(true).

Since many activities do not use the action bar home button, in apps that target API 14+ running on Android 4.0 it is disabled by default. (This is so that users don't try pressing it, see it glow, and wonder why nothing happened.) Apps that want to use this should call ActionBar#setHomeButtonEnabled(true).

我们也许应该修改ActionBarCompat样本更清晰地浮出水面这一点。一个简单的办法让你和运行将修改ActionBarHelperICS.java并添加以下内容:

We should probably revise the ActionBarCompat sample to surface this more clearly. One simple way to get you up and running would be to modify ActionBarHelperICS.java and add the following:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mActivity.getActionBar().setHomeButtonEnabled(true);
}

在你想要更多地控制开启和关闭,你把这个将要作进一步修改的应用程序。

In an app where you want more control over turning this on and off you would want to make further changes.

这篇关于ActionBarCompat - 应用程序图标操作(点击)不工作4.0设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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