为什么片段重叠的行动吧? [英] Why the fragment overlaps the Action bar?

查看:168
本文介绍了为什么片段重叠的行动吧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着使用android支持库V7将动作栏添加到我的活动我伸出THT动作条的活动。 一个空白的片段已还内置制作标签。 然而,该片段的内容被重叠操作栏。 我该如何解决这个问题?

解决方案

我在这里<一读href="http://stackoverflow.com/questions/17881297/actionbar-with-support-library-and-fragments-overlay-content#17920694">ActionBar与支持库和碎片覆盖内容 我相信它会帮助你:

有关pre ICS的设备必须使用:

  R.id.action_bar_activity_content
 

而不是

  android.R.id.content
 

R.id.action_bar_activity_content是在布局用于显示应用程序内容的新的ID,它会出现,它取代android.R.id.content当您使用支持V7 appcompat ActionBarActivity。

您可以使用此code检索活动内容的正确ID:

 公共静态INT getContentViewCompat(){
返回Build.VERSION.SDK_INT&GT; = Build.VERSION_ codeS.ICE_CREAM_SANDWICH?
           android.R.id.content:R.id.action_bar_activity_content;
}
 

I tried to use the android support library v7 to add an action bar to my activity my extending tht actionbar activity. A blank fragment has been also built to make a tab. However, the content of the fragment is overlapping the action bar. How can I fix it?

解决方案

I read it here ActionBar with support library and Fragments overlay content I am sure it will help you :

For pre ICS devices you must use:

R.id.action_bar_activity_content

instead of

android.R.id.content

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.

You can use this code to retrieve the correct id of the activity content :

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

这篇关于为什么片段重叠的行动吧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆