當(dāng)前位置:
首頁 >
android 标题图标,android 中 actionbar 常用方法。设置标题,隐藏图标等
發(fā)布時間:2024/10/8
38
豆豆
生活随笔
收集整理的這篇文章主要介紹了
android 标题图标,android 中 actionbar 常用方法。设置标题,隐藏图标等
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
設(shè)置標(biāo)題:
actionBar.setTitle("關(guān)于我們");
使返回箭頭出現(xiàn)
actionBar.setDisplayHomeAsUpEnabled(true);
監(jiān)聽返回按鈕的 事件
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
隱藏圖標(biāo)logo
使用將logo設(shè)置透明的方式:
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
總結(jié)
以上是生活随笔為你收集整理的android 标题图标,android 中 actionbar 常用方法。设置标题,隐藏图标等的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 华安助学贷款怎么还款
- 下一篇: android控件常用的属性,andro