-2

我已经制作了 asherlock 操作栏。当我在模拟器上运行它时它运行良好,但是当我尝试在我的 android 手机上运行它时,它显示运行时异常,请在应用程序的清单文件中添加 sherlockk 主题。即使我已经添加了它,但问题依旧。这是清单文件:

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

    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />

    <application
         >
       android:theme="@style/Theme.Sherlock.Light"
        <activity
            android:name=".NaseebactionbarActivity"
             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


        <activity
            android:name=".DashboardLayout"
            /> 
             <activity
            android:name=".ActionBarActivity"
            /> 
            <activity
            android:name=".controltransfer"
            /> 

    </application>

</manifest>

这是一个例外:

07-24 20:29:57.605: E/AndroidRuntime(12921): FATAL EXCEPTION: main
07-24 20:29:57.605: E/AndroidRuntime(12921): java.lang.RuntimeException: Unable to start activity ComponentInfo{naseeb.bar/naseeb.bar.NaseebactionbarActivity}: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1746)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1765)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.ActivityThread.access$1500(ActivityThread.java:158)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:996)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.os.Handler.dispatchMessage(Handler.java:130)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.os.Looper.loop(SourceFile:351)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.ActivityThread.main(ActivityThread.java:3850)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at java.lang.reflect.Method.invokeNative(Native Method)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at java.lang.reflect.Method.invoke(Method.java:538)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at dalvik.system.NativeStart.main(Native Method)
07-24 20:29:57.605: E/AndroidRuntime(12921): Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
07-24 20:29:57.605: E/AndroidRuntime(12921):    at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1007)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:919)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:218)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at naseeb.bar.NaseebactionbarActivity.onCreate(NaseebactionbarActivity.java:20)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
07-24 20:29:57.605: E/AndroidRuntime(12921):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1710)
07-24 20:29:57.605: E/AndroidRuntime(12921):    ... 11 more
07-24 20:34:57.633: I/Process(12921): Sending signal. PID: 12921 SIG: 9

请告诉我如何解决这个问题。

4

1 回答 1

1
 <application
         >
       android:theme="@style/Theme.Sherlock.Light"

是错的。您正在关闭应用程序标签,在您的主题之前。

利用

 <application
       android:theme="@style/Theme.Sherlock.Light">
于 2012-07-24T15:11:33.483 回答