首页 > 移动平台 > 详细

在低版本Android中fragment会overlay ActionBar区域

时间:2014-02-26 04:05:14      阅读:415      评论:0      收藏:0      [点我收藏+]

1 问题

It works like a charm on android 4.0+ and also on android 2.3 with a normal Activity that has setContentView in onCreate, but when the activity is loading an Fragment in onCreate the ActionBar gets overlapped with the content of my layout. At all other scenarios the ActionBar works well.
2 解释

R.id.action_bar_activity_content is a new id used in layout for displaying app content, it would appear that it replace android.R.id.content when you use support v7 appcompat ActionBarActivity.
3 解决方案

  public static int getContentViewCompat() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ?
                android.R.id.content : android.support.v7.appcompat.R.id.action_bar_activity_content;
    }

感谢大神:

https://code.google.com/p/android/issues/detail?id=58108

在低版本Android中fragment会overlay ActionBar区域

原文:http://blog.csdn.net/zqx198810/article/details/19904699

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!