gpt4 book ai didi

安卓。 ActionBarSherlock。

转载 作者:太空狗 更新时间:2023-10-29 16:05:49 26 4
gpt4 key购买 nike

尝试从 ActionBarSherlock 开始。下载库。使用上次更新设置 ADT,SDK 相同。

尝试进行简单的 Activity :

import com.actionbarsherlock.app.SherlockActivity;
import android.os.Bundle;

public class MainActivity extends SherlockActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

list :

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

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Sherlock.__Theme" >
<activity
android:name="ru.alxr.usingsherlocksample.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>
</application>

</manifest>

ADT 不允许设置 android:theme="@style/Sherlock"为红色 x。

所以,我在 logcat 中得到了预期的错误:

03-23 21:25:54.437: E/AndroidRuntime(13145): FATAL EXCEPTION: main
03-23 21:25:54.437: E/AndroidRuntime(13145): java.lang.RuntimeException: Unable to start activity ComponentInfo{ru.alxr.usingsherlocksample/ru.alxr.usingsherlocksample.MainActivity}: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.os.Handler.dispatchMessage(Handler.java:99)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.os.Looper.loop(Looper.java:130)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-23 21:25:54.437: E/AndroidRuntime(13145): at java.lang.reflect.Method.invokeNative(Native Method)
03-23 21:25:54.437: E/AndroidRuntime(13145): at java.lang.reflect.Method.invoke(Method.java:507)
03-23 21:25:54.437: E/AndroidRuntime(13145): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
03-23 21:25:54.437: E/AndroidRuntime(13145): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
03-23 21:25:54.437: E/AndroidRuntime(13145): at dalvik.system.NativeStart.main(Native Method)
03-23 21:25:54.437: E/AndroidRuntime(13145): Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
03-23 21:25:54.437: E/AndroidRuntime(13145): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1003)
03-23 21:25:54.437: E/AndroidRuntime(13145): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:915)
03-23 21:25:54.437: E/AndroidRuntime(13145): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:849)
03-23 21:25:54.437: E/AndroidRuntime(13145): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
03-23 21:25:54.437: E/AndroidRuntime(13145): at ru.alxr.usingsherlocksample.MainActivity.onCreate(MainActivity.java:13)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-23 21:25:54.437: E/AndroidRuntime(13145): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-23 21:25:54.437: E/AndroidRuntime(13145): ... 11 more

怎么办?

最佳答案

在您的 list 中替换:

android:theme="@style/Sherlock.__Theme"

与:

android:theme="@style/Theme.Sherlock"

或任何其他有效的主题,例如:

android:theme="@style/Theme.Sherlock.Light"
android:theme="@style/Theme.Sherlock.Light.DarkActionBar"

关于安卓。 ActionBarSherlock。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15588227/

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