无法解析@风格/ Theme.Sherlock [英] Cannot Resolve @style/Theme.Sherlock

查看:419
本文介绍了无法解析@风格/ Theme.Sherlock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想利用动作条福尔摩斯4,针对SDK 15分钟SDK 8.下列设在使用网站上的方向和伟大的视频张贴在这里经过:的http://www.youtube.com/watch?v=avcp6eD_X2k

I'm trying to make use of Actionbar Sherlock 4, targeting sdk 15 and min sdk 8. After following the directions provided on the Usage website and the great videos posted here: http://www.youtube.com/watch?v=avcp6eD_X2k

我还是遇到了问题。当我尝试添加机器人:主题=@风格/ Theme.Sherlock我的清单文件,我得到了错误:

I'm still encountering a problem. When I try to add android:theme="@style/Theme.Sherlock" to my manifest file , I get the error:

没有资源的发现与价值相匹配给定名称(在主题   @风格/ Theme.Sherlock)。

No resource found that matches the given name (at 'theme' with value '@style/Theme.Sherlock').

我已经包含了动作条福尔摩斯库项目到我的项目,并导入语句在那里,不来了任何错误,我已经

I have included the actionbar Sherlock library project into my project, and the import statements are there and not coming up with any errors and I've

扩展SherlockActivity实现ActionBar.TabListener

extends SherlockActivity implements ActionBar.TabListener

就像在演示code和文档可是偏偏,日食给我这个错误。任何想法了吗?

just like in the Demo code and documentation Yet still, eclipse gives me this error. Any ideas out there?

推荐答案

我遇到一个奇怪的反常现象,这可能有助于!

I encountered a strange anomaly that might help!

已经建立,使用ABS Android项目,在姜饼运行它工作正常,在ICS崩溃,ICS在崩溃的发生是由于这一点,请检查您的的Andr​​oidManifest.xml 的(已修剪出位简洁...

Have built android project that uses ABS, running it on Gingerbread works fine, in ICS it crashes, the crash under ICS occurs due to this, check your AndroidManifest.xml (have trimmed out bits for brevity...

<application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:theme="@style/Theme.Sherlock">

这是在安卓主题部分导致ICS下崩溃,它姜饼和旧版本下工作得很好!解决方案是完全删除!然后从你的活动,做到这一点:

It was the android:theme part that caused the crash under ICS, it worked fine under Gingerbread and older versions!. Solution was to remove it completely! Then from your Activity, do this:

@Override
public void onCreate(Bundle savedInstanceState) {
   if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH){
        this.setTheme(com.actionbarsherlock.R.style.Theme_Sherlock);
   }
   super.onCreate(savedInstanceState);
   ... // MORE CODE ....
}

这搞掂ICS下崩溃,主题样式不是由ICS喜欢,但它工作正常,小于2.3和4.0以上两个版本..奇怪的错误,但我发现的侥幸!

This fixed up the crash under ICS, the theme style is not liked by ICS, but it works fine for both versions less than 2.3 and 4.0 upwards.. weird error but that I discovered by fluke!

记得之前调用基类自身的的onCreate 的!

Remember to apply the theme before calling the base class's own onCreate!

这篇关于无法解析@风格/ Theme.Sherlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆