如何使sdk 9 android应用程序全屏显示失败

如何使sdk 9 android应用程序全屏显示失败,android,android-layout,android-studio,Android,Android Layout,Android Studio,好的,这里是我的所有代码,但当我尝试运行时失败 这里是java代码 package com.monstermmorpg.pokemon; import android.content.Intent; import android.net.Uri; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.Menu

好的,这里是我的所有代码,但当我尝试运行时失败

这里是java代码

package com.monstermmorpg.pokemon;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;

public class Pokemon extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pokemon);
        addListenerOnButton();
    }

    private void addListenerOnButton() {

        ImageButton imgButton = (ImageButton) findViewById
                (R.id.imageButton_register);

        imgButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("http://www.monstermmorpg.com/Register");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });
    }
}
下面是Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".Pokemon"
android:background="@color/background_floating_material_dark">

<ImageButton
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/imageButton_register"
    android:background="@null"
    android:src="@drawable/image_button"
    android:adjustViewBounds="true"
    android:scaleType="centerInside"
    android:layout_centerInParent="true"
    />

您正在使用主题
android:Theme=“@android:style/Theme.NoTitleBar.Fullscreen”
,错误日志告诉您

You need to use a Theme.AppCompat theme (or descendant) with this activity.
可能是因为您试图在活动中使用支持库(
import android.support.v7.app.ActionBarActivity;


因此,您的解决方案是坚持日志并使用符合
theme.AppCompat
的主题,或者使用不依赖于支持库的活动。在第一种情况下,您需要将style.xml文件中的父主题设置为
theme.AppCompat

,这方面您运气好吗?
    03-15 15:45:58.043    2653-2653/com.monstermmorpg.pokemon E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.monstermmorpg.pokemon, PID: 2653
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.monstermmorpg.pokemon/com.monstermmorpg.pokemon.Pokemon}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:152)
            at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:149)
            at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123)
            at com.monstermmorpg.pokemon.Pokemon.onCreate(Pokemon.java:16)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-15 15:45:58.046    2653-2660/com.monstermmorpg.pokemon E/art﹕ Failed sending reply to debugger: Broken pipe
03-15 15:45:58.046    2653-2660/com.monstermmorpg.pokemon I/art﹕ Debugger is no longer active
You need to use a Theme.AppCompat theme (or descendant) with this activity.