开发者

android action bar

@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.button1:
                // app icon in Action Bar clicked; go home
                Intent intent = new Intent(this, ClientInfoActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }

I want to implement action bar in my application page. The above code is not working. Any sugge开发者_开发问答stions?


A couple of things that may help. To start with the easy to use baked in action bar is only available for android version 3.0 and up by default (tablet). So if you are developing an app for a tablet then the next bit doesn't apply.

Otherwise I think the easiest thing to do would be to look at this guys action bar and reference it or look at the question: android action bar like twitter?

For android 3.0 and up specifically (tablet only) .....

I noticed your using the code from google's action bar design guide. Full working code generally helps me get started better than many of the developer guide code snippets. (but they are useful too...). So I'd recommend you take a look at a couple of the full working examples of using the action bar that are in the android Api demos in the android SDK you downloaded with android. I would start there before looking at the android action bar guide.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜