我在oncreate中使用setcontentview行获取Runtimeexception。我已经详细查看了代码,也在线查看了代码。无法弄清楚问题是什么。这是代码 -
public class FullScreenActivity extends Activity {
public FrameLayout fl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen); //Exception here
fl = (FrameLayout) this.findViewById(R.id.framefull);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
和XML -
<FrameLayout
android:id="@+id/framefull"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
>
</FrameLayout>
Logcat -
01-02 18:51:54.950: W/ActivityThread(3584): Application com.example.twinkey is waiting for the debugger on port 8100...
01-02 18:51:54.966: I/System.out(3584): Sending WAIT chunk
01-02 18:51:54.989: I/art(3584): Debugger is active
01-02 18:51:55.172: I/System.out(3584): Debugger has connected
01-02 18:51:55.179: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:55.379: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:55.581: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:55.783: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:55.983: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:56.185: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:56.385: I/System.out(3584): waiting for debugger to settle...
01-02 18:51:56.586: I/System.out(3584): debugger has settled (1444)
01-02 18:52:05.822: D/AndroidRuntime(3584): Shutting down VM
01-02 18:52:05.827: E/AndroidRuntime(3584): FATAL EXCEPTION: main
01-02 18:52:05.827: E/AndroidRuntime(3584): Process: com.example.twinkey, PID: 3584
01-02 18:52:05.827: E/AndroidRuntime(3584): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.twinkey/com.example.twinkey.FullScreenActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.ActivityThread.access$800(ActivityThread.java:144)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.os.Handler.dispatchMessage(Handler.java:102)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.os.Looper.loop(Looper.java:135)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.ActivityThread.main(ActivityThread.java:5221)
01-02 18:52:05.827: E/AndroidRuntime(3584): at java.lang.reflect.Method.invoke(Native Method)
01-02 18:52:05.827: E/AndroidRuntime(3584): at java.lang.reflect.Method.invoke(Method.java:372)
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
01-02 18:52:05.827: E/AndroidRuntime(3584): Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:321)
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3259)
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3561)
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:367)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.Activity.setContentView(Activity.java:2144)
01-02 18:52:05.827: E/AndroidRuntime(3584): at com.example.twinkey.FullScreenActivity.onCreate(FullScreenActivity.java:60)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.Activity.performCreate(Activity.java:5943)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
01-02 18:52:05.827: E/AndroidRuntime(3584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
01-02 18:52:05.827: E/AndroidRuntime(3584): ... 10 more
任何人都可以帮助解决错误吗?花了将近2个小时。