Android笔记之标题栏的各种操作

1、改变标题栏的背景颜色

this.setTitleColor(textColor);

2、为页面设置返回键

ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
...
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // TODO Auto-generated method stub
        switch (item.getItemId()) {
        case android.R.id.home:
            finish();
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }

    }

Done

posted @ 2014-04-28 18:55  行云有影  阅读(290)  评论(0编辑  收藏  举报