アプリケーションでは、ActionBar Sherlock
. アプリケーションの他の 2 つのアクティビティに同じテーマを使用しているため、発生するエラーは非常に奇妙に思えます。
マニフェスト:
<activity
android:name=".ABC"
android:label="@string/app_name"
android:theme="@style/transTheme" >
<intent-filter >
<action android:name="com.example.ABC"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".XYZ"
android:label="@string/app_name"
android:theme="@style/transTheme" >
<intent-filter >
<action android:name="com.example.XYZ"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".123"
android:label="@string/app_name"
android:theme="@style/transTheme" >
<intent-filter >
<action android:name="com.example.123"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
スタイル:
<!-- Transparent Layout Themeing -->
<style name="transTheme" parent="android:style/Theme.Translucent">
<item name ="android:windowNoTitle">true</item>
<item name ="android:windowContentOverlay">@null</item>
<item name ="android:backgroundDimEnabled">true</item>
<item name ="android:background">@android:color/transparent</item>
</style>
マニフェスト ファイルと同様に、アクティビティ ABC と XYZ はエラーなしで動作します。アクティビティ 123 でエラーが発生します。
エラーログ:
09-08 10:40:08.446: E/AndroidRuntime(23791): FATAL EXCEPTION: main
09-08 10:40:08.446: E/AndroidRuntime(23791): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vaw.selfhelp/com.vaw.selfhelp.SureSMS}: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.os.Handler.dispatchMessage(Handler.java:99)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.os.Looper.loop(Looper.java:130)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.ActivityThread.main(ActivityThread.java:3687)
09-08 10:40:08.446: E/AndroidRuntime(23791): at java.lang.reflect.Method.invokeNative(Native Method)
09-08 10:40:08.446: E/AndroidRuntime(23791): at java.lang.reflect.Method.invoke(Method.java:507)
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-08 10:40:08.446: E/AndroidRuntime(23791): at dalvik.system.NativeStart.main(Native Method)
09-08 10:40:08.446: E/AndroidRuntime(23791): Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1003)
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:915)
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:849)
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
09-08 10:40:08.446: E/AndroidRuntime(23791): at com.vaw.selfhelp.SureSMS.onCreate(SureSMS.java:29)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-08 10:40:08.446: E/AndroidRuntime(23791): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
09-08 10:40:08.446: E/AndroidRuntime(23791): ... 11 more
SureSMS.java (または 123.java) 29 行目
setContentView(R.layout.123layout);
私は
setTheme(R.style.transTheme)
エラーを取り除いたJavaクラスでは、これはアクティビティの透明性ではありませんでした。アプリケーションは、ハニカム以上のデバイスで正常に動作します。Android 3.0 未満のデバイスでのみこのエラーが発生します。助けてください。