requestWindowFeature(Window.FEATURE_NO_TITLE);导致应用程序崩溃? [英] requestWindowFeature(Window.FEATURE_NO_TITLE); causing the App to crash?

查看:283
本文介绍了requestWindowFeature(Window.FEATURE_NO_TITLE);导致应用程序崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用crashs当我加入这行

`requestWindowFeature(Window.FEATURE_NO_TITLE);

可能是解决的方法很简单,但我真的不知道谁解决它。

Java的code:

 公共类GLSurfaceCameraSurfaceDemo2Activity延伸活动{
/ **当第一次创建活动调用。 * /GLSurfaceView glSurfaceView;
的FrameLayout FL01;@覆盖
公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.main);    requestWindowFeature(Window.FEATURE_NO_TITLE);}

}

XML文件:

 <的FrameLayout
        机器人:ID =@ + ID / FL01
        机器人:方向=横向
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT/>


解决方案

您必须调用requestWindowFeature(Window.FEATURE_NO_TITLE);的setContentView()之前...

 公共类GLSurfaceCameraSurfaceDemo2Activity延伸活动{
/ **当第一次创建活动调用。 * /GLSurfaceView glSurfaceView;
的FrameLayout FL01;@覆盖
公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    的setContentView(R.layout.main);}

The App crashs when I add this line

`requestWindowFeature(Window.FEATURE_NO_TITLE);

may be the solution is very simple, but i really dont know who to fix it.

Java code:

public class GLSurfaceCameraSurfaceDemo2Activity extends Activity {
/** Called when the activity is first created. */

GLSurfaceView glSurfaceView;
FrameLayout fl01;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    requestWindowFeature(Window.FEATURE_NO_TITLE);

}

}

XML File:

<FrameLayout 
        android:id="@+id/fl01" 
        android:orientation="horizontal" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"/>  

解决方案

you must call requestWindowFeature(Window.FEATURE_NO_TITLE); before setContentView()...

public class GLSurfaceCameraSurfaceDemo2Activity extends Activity {
/** Called when the activity is first created. */

GLSurfaceView glSurfaceView;
FrameLayout fl01;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

}

这篇关于requestWindowFeature(Window.FEATURE_NO_TITLE);导致应用程序崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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