2

添加此行时应用程序崩溃

`requestWindowFeature(Window.FEATURE_NO_TITLE);

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

Java代码:

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 文件:

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

2 回答 2

14

你必须调用 requestWindowFeature(Window.FEATURE_NO_TITLE); 在 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);

}
于 2012-03-16T12:21:20.040 回答
1

这样做:

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

    setContentView(R.layout.main);

}

你必须requestWindowFeature(Window.FEATURE_NO_TITLE);先声明super.onCreate(savedInstanceState);

于 2015-07-07T13:24:23.013 回答