gpt4 book ai didi

android - Holo 主题在启动画面上不起作用...应用程序崩溃

转载 作者:行者123 更新时间:2023-11-29 21:06:50 30 4
gpt4 key购买 nike

您好,我想为我的应用程序添加全息主题,但是当我检查我的初始图形布局时,它似乎不起作用并且我的应用程序崩溃了。我想为整个应用程序添加全息主题。此外,我想摆脱启动画面之前的屏幕。我不知道该怎么做

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sachinda.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo">
<activity
android:name="com.sachinda.myfirstapp.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

这是日志

06-18 01:16:54.390: I/Process(7860): Sending signal. PID: 7860 SIG: 9
06-18 01:16:55.530: D/HyLog(8955): I : /data/font/config/sfconfig.dat, No such file or directory (2)
06-18 01:16:55.530: D/HyLog(8955): I : /data/font/config/dfactpre.dat, No such file or directory (2)
06-18 01:16:55.530: D/HyLog(8955): I : /data/font/config/sfconfig.dat, No such file or directory (2)
06-18 01:16:55.570: D/AndroidRuntime(8955): Shutting down VM
06-18 01:16:55.570: W/dalvikvm(8955): threadid=1: thread exiting with uncaught exception (group=0x41ae6e48)
06-18 01:16:55.570: E/AndroidRuntime(8955): FATAL EXCEPTION: main
06-18 01:16:55.570: E/AndroidRuntime(8955): Process: com.sachinda.myfirstapp, PID: 8955
06-18 01:16:55.570: E/AndroidRuntime(8955): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sachinda.myfirstapp/com.sachinda.myfirstapp.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.ActivityThread.access$800(ActivityThread.java:139)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.os.Looper.loop(Looper.java:136)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.ActivityThread.main(ActivityThread.java:5105)
06-18 01:16:55.570: E/AndroidRuntime(8955): at java.lang.reflect.Method.invokeNative(Native Method)
06-18 01:16:55.570: E/AndroidRuntime(8955): at java.lang.reflect.Method.invoke(Method.java:515)
06-18 01:16:55.570: E/AndroidRuntime(8955): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
06-18 01:16:55.570: E/AndroidRuntime(8955): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
06-18 01:16:55.570: E/AndroidRuntime(8955): at dalvik.system.NativeStart.main(Native Method)
06-18 01:16:55.570: E/AndroidRuntime(8955): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
06-18 01:16:55.570: E/AndroidRuntime(8955): at com.sachinda.myfirstapp.MainActivity.onCreate(MainActivity.java:24)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.Activity.performCreate(Activity.java:5275)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-18 01:16:55.570: E/AndroidRuntime(8955): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
06-18 01:16:55.570: E/AndroidRuntime(8955): ... 11 more

最佳答案

您的 Activity 可能会扩展 ActionbarActivity,在这种情况下您需要拥有 Theme.AppCompat 主题(或后代)。

你有什么

 android:theme="@android:style/Theme.Holo">

您的主题不是来自AppCompat

 android:theme="@style/Theme.AppCompat

或从 AppCompat 派生的主题。

引用文档

使用支持库时,您必须改用 Theme.AppCompat 主题:

Theme.AppCompat for the "dark" theme.
Theme.AppCompat.Light for the "light" theme.
Theme.AppCompat.Light.DarkActionBar for the light theme with a dark action bar.

关于android - Holo 主题在启动画面上不起作用...应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24277485/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com