我正在尝试将 abs 集成到我的应用程序中,但我不断收到有关无法膨胀 com.actionbarsherlock.internal.widget.ActionBarContainer 的错误。谁能帮忙?
“样式.xml”
<resources>
<style name="AppTheme" parent="Theme.Sherlock.Light" />
</resources>
“activity_main.xml”
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
“安卓 list .xml”
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.e.ffgh"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
"主 Activity .java"
package com.e.ffgh;
import com.actionbarsherlock.app.SherlockActivity;
import android.os.Bundle;
public class MainActivity extends SherlockActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
08-26 06:13:36.442: E/AndroidRuntime(1464): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.e.ffgh/com.e.ffgh.MainActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
更新:精简帖子。以最低限度开始了一个 BS 项目。它适用于 ICS,但在 Gingerbread 或 Froyo 中仍然出现“Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer”错误
最佳答案
我意识到每当我修复 ActionBarSherlock 库中的警告时就会出现问题。我不认为他们会有所作为,但显然他们做到了。我没有进一步检查我在库中修复的是什么警告导致编译变坏,但我认为是在我抑制了关于 IcsProgressBar 类中不推荐使用的“android.R.attr.animationResolution”的警告时。稍后我会研究它,但要点是,导入时不要弄乱 ActionBarSherlock 库。
关于java - 膨胀类 com.actionbarsherlock.internal.widget.ActionBarContainer 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12125376/