的Andr​​oid如何在动作条点击标识图标?图标、标识、动作、如何在

由网友(空人空心空世界)分享简介:我真的使用SherlockActionBar我的应用程序。在我的清单我定义的标志和启动图标。 I`m using SherlockActionBar for my application. In my manifest I define icon for logo and launch. android:icon="...

我真的使用SherlockActionBar我的应用程序。在我的清单我定义的标志和启动图标。

I`m using SherlockActionBar for my application. In my manifest I define icon for logo and launch.

    android:icon="@drawable/ic_launcher"

如何使它可以点击的,处理它`pressing事件?我希望能够要回我的仪表板由pressing的标志。

How to make it clickable and handle the event of it`s pressing? I want to be able to back to my dashboard by pressing the logo.

推荐答案

使用

actionBar.setDisplayHomeAsUpEnabled(true);

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        //Do stuff
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}
阅读全文

相关推荐

最新文章