关于自定义actionbar 左上角填不满整个区域的问题

来源:互联网 发布:stc89le52rc数据手册 编辑:程序博客网 时间:2024/05/06 16:56

一、自定义ActionBar样式

1、奇怪的问题

 这是自定义ActionBar样式的布局


1
2
3
4
5
View customView = getLayoutInflater().inflate(R.layout.actionbar_custom_view,null);
ActionBarUtil.init();
// ...
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setCustomView(customView);

实际显示的时候,在4.4.2系统,ActionBar左上角有一块区域不是自定义的布局。在当前Activity的父类或者上述代码前,调用如下代码,则显示正常:


1
2
3
4
// 测试发现在4.4系统上,没有该代码,则custom ActionBar左上角有问题
if (getSupportActionBar() != null) {
     getSupportActionBar().setTitle("");
}

 

    
0 0
原创粉丝点击