android 标题图标,android 中 actionbar 常用方法。设置标题,隐藏图标等
生活随笔
收集整理的這篇文章主要介紹了
android 标题图标,android 中 actionbar 常用方法。设置标题,隐藏图标等
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
設置標題:
actionBar.setTitle("關于我們");
使返回箭頭出現
actionBar.setDisplayHomeAsUpEnabled(true);
監聽返回按鈕的 事件
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
隱藏圖標logo
使用將logo設置透明的方式:
getActionBar().setIcon(
new ColorDrawable(getResources().getColor(android.R.color.transparent)));
參考:
http://stackoverflow.com/questions/14606294/remove-icon-logo-from-action-bar-on-android
原文:http://www.cnblogs.com/vir56k/p/3946687.html
總結
以上是生活随笔為你收集整理的android 标题图标,android 中 actionbar 常用方法。设置标题,隐藏图标等的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 华安助学贷款怎么还款
- 下一篇: android调用另一app的xml,A