Android的全屏不工作:姜饼 [英] Android Fullscreen Not Working: Gingerbread

查看:196
本文介绍了Android的全屏不工作:姜饼的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个全屏的活动,但它似乎并没有在姜饼的工作,这是我的code

I am trying to make a fullscreen activity, but it doesn't seem to work in GingerBread, here is my code

 @SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_eyes);
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
    ActionBar actionBar = getActionBar();
    actionBar.hide();

}

   if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD){
       requestWindowFeature(Window.FEATURE_NO_TITLE);
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   }

在姜饼仍然有一个标题。

In Gingerbread there is still a title.

有谁知道如何解决这一问题?

Does anyone know how to fix this?

推荐答案

请记住,你必须调用 requestWindowFeature 呼叫前的setContentView

Remember that you must call requestWindowFeature before call setContentView

试试这个在Java做一个全屏幕活动:

Try this to make a full screen activity by java:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

在清单

android:theme="@android:style/Theme.Translucent.NoTitleBar"

这篇关于Android的全屏不工作:姜饼的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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