ActionBarSherlock与Android Action Bar Style Generator

时间:2013-12-11 19:11:52

标签: android actionbarsherlock

我正在将ActionBarSherlock与Android操作栏样式生成器(http://jgilfelt.github.io/android-actionbarstylegenerator/)一起使用,它与API v14 +完美配合,但在v10-v14上,我得到以下内容:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.loginregistration.Login}: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1821)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
        at android.app.ActivityThread.access$1500(ActivityThread.java:132)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:150)
        at android.app.ActivityThread.main(ActivityThread.java:4263)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:507)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light,     Theme.Sherlock.Light.DarkActionBar, or a derivative.
        at     com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:976)
        at     com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:902)
        at     com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:836)
        at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
        at com.myapp.loginregistration.Login.onCreate(Login.java:25)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)

有没有让风格发生器与Api 10-14配合使用?现在我在使用较低的API手机时将其设置为默认为Theme.Sherlock,因此bug消失了,但它不是我想要的风格。

1 个答案:

答案 0 :(得分:1)

你想要什么样的风格?

主题生成器适用于Android Holo,ActionbarSherlock或Appcompat。

Theme.Sherlock,Theme.Sherlock.Light和Theme.Sherlock.Light.DarkActionbar都只是Holo,Holo.Light和Holo.Light.DarkActionbar的端口,所以你可以在api 11+中获得任何主题,你可以使用ActionbarSherlock。

你想要达到什么样的风格?