我收到了一份崩溃报告,其中包含由 Resource.NotFoundException 引起的错误。然而,奇怪的是,当 DialogFragment 试图使用 res/color/secondary_text_dark.xml 颜色(在其创建期间)时,Android 兼容性库会抛出它。这是一个 Android 资源(在 android.R.color.secondary_text_dark 中找到),所以我假设每个设备都应该有这个可用。
我知道异常是由于混淆器混淆了资源引起的,但我不确定如何避免这种情况。 我无法在我的 Nexus One 上重现崩溃,因此我无法检查更改是否解决了这个问题。
我对混淆器的看法是否正确,还是有任何其他因素可能导致这种情况?
非常感谢。
我在这里附上了日志:
android.view.InflateException: Binary XML file line #8: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at org.kaloersoftware.kaloerclock.MathDialogFragment.android.view.View onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)(Unknown Source)
at android.support.v4.app.FragmentManagerImpl.void moveToState(android.support.v4.app.Fragment,int,int,int)(Unknown Source)
void moveToState(android.support.v4.app.Fragment)
void moveToState(int,boolean)
void moveToState(int,int,int,boolean)
at android.support.v4.app.FragmentManagerImpl.void moveToState(android.support.v4.app.Fragment,int,int,int)(Unknown Source)
void moveToState(android.support.v4.app.Fragment)
void moveToState(int,boolean)
void moveToState(int,int,int,boolean)
at android.support.v4.app.BackStackRecord.void run()(Unknown Source)
at android.support.v4.app.FragmentManagerImpl.boolean execPendingActions()(Unknown Source)
at android.support.v4.app.FragmentManagerImpl$1.void run()(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4669)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.TextView.<init>(TextView.java:329)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 20 more
Caused by: android.content.res.Resources$NotFoundException: File res/color/secondary_text_dark.xml from color state list resource ID #0x0
at android.content.res.Resources.loadColorStateList(Resources.java:1817)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
at android.widget.TextView.<init>(TextView.java:394)
... 24 more
Caused by: android.content.res.Resources$NotFoundException: File res/color/secondary_text_dark.xml from xml type colorstatelist resource ID #0x0
at android.content.res.Resources.loadXmlResourceParser(Resources.java:1924)
at android.content.res.Resources.loadColorStateList(Resources.java:1812)
... 26 more
这是 layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="8dip"
android:background="#33332D"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:gravity="center"
android:paddingBottom="10dip"
android:textColor="@color/ltgrey"
android:id="@+id/math_question_question"
/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="2">
<TableRow>
<Button
android:textSize="30sp"
android:id="@+id/math_question_ans1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:textSize="30sp"
android:id="@+id/math_question_ans2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</TableRow>
<TableRow>
<Button
android:textSize="30sp"
android:id="@+id/math_question_ans3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:textSize="30sp"
android:id="@+id/math_question_ans4"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
<Button
android:textSize="30sp"
android:id="@+id/math_question_cancel"
android:text="@string/math_question_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
第一个TextView中的textColor在我的colors.xml文件中引用了这个
<color name="ltgrey">#ffe0e0e0</color>
最佳答案
it is thrown by the Android compatibility library in a DialogFragment when it is trying to use the res/color/secondary_text_dark.xml colour (during its creation). This is an Android resource (found in android.R.color.secondary_text_dark), so I assume that every device should have this available.
Android 正在尝试根据您的堆栈跟踪加载 R.color.secondary_text_dark,而不是 android.R.color.secondary_text_dark。
关于android - Resources.NotFoundException 在 res/color/secondary_text_dark.xml 上抛出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6060592/
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路
-if!request.path_info.include?'A'%{:id=>'A'}"Text"-else"Text"“文本”写了两次。我怎样才能只写一次并同时检查path_info是否包含“A”? 最佳答案 有两种方法可以做到这一点。使用部分,或使用content_forblock:如果“文本”较长,或者是一个重要的子树,您可以将其提取到一个部分。这会使您的代码变干一点。在给出的示例中,这似乎有点矫枉过正。在这种情况下更好的方法是使用content_forblock,如下所示:-if!request.path_info.inc
我在尝试使用Nokogiri构建XML文档时遇到了一个小问题。我想将我的元素之一称为“文本”(请参阅下面粘贴代码的最底部)。通常,要创建一个新元素,我会执行类似以下的操作xml.text--但它似乎是.text是Nokogiri已经用来做其他事情的方法。因此,当我写这行时xml.textNokogiri没有创建名为的新元素但只是写了意味着成为元素内容的文本。我怎样才能让Nokogiri实际制作一个名为的元素??builder=Nokogiri::XML::Builder.newdo|xml|xml.TEI("xmlns"=>"http://www.tei-c.org/ns/1.0"
所以...SublimeText具有折叠方法的内置功能,但是一旦方法声明跨越多行,它就会失去这种能力。有谁知道插件或使它工作的方法吗?具体来说,我在使用ruby时遇到了这个问题(我的团队遵守关于行长度的严格风格指南),但语言应该无关紧要。 最佳答案 无需单击出现在函数定义第一行旁边的装订线中的向下箭头,您需要做的就是将光标放在函数的一个缩进行上(不是缩进的函数参数,而是在函数定义本身)并使用CtrlShift[键绑定(bind)(在OSX上使用⌘Alt[)折叠函数及其参数。使用CtrlShift](⌘Alt]在OSX上)展开,或
我是程序员的新手,请原谅我的新手。所以我正在使用Nokogiri来抓取警方的犯罪记录。这是下面的代码:require'rubygems'require'nokogiri'require'open-uri'url="http://www.sfsu.edu/~upd/crimelog/index.html"doc=Nokogiri::HTML(open(url))putsdoc.at_css("title").textdoc.css(".brief").eachdo|brief|putsbrief.at_css("h3").textend我使用选择器小工具书签来查找日志(.brief)的C
Ruby“OptionParser将根据此描述自动为您生成帮助屏幕”[http://ruby.about.com/od/advancedruby/a/optionparser.htm]有没有办法删除命令选项的帮助文本。我可以使用隐藏命令,但有一个命令选项(开关)并隐藏其帮助上下文。 最佳答案 我能够为此拼凑出一个不太优雅的解决方案。它将隐藏主帮助屏幕中的选项,听起来它可能符合您的需要:require'optparse'options={}OptionParser.newdo|opts|opts.banner="Usage:#{$0}
我正在使用SublimeText2,同时遵循MichaelHartl的RubyonRails教程。可以在http://ruby.railstutorial.org/book/ruby-on-rails-tutorial找到我所指的教程的具体部分。(ctrl+F“list5.26”)。我能够创建规范/支持文件。但是,在尝试创建spec/support/utilities.rb文件时,我收到消息“无法保存~/rails_projects/sample_app/spec/support/utilities.rb”。有人知道为什么会这样吗?SublimeText论坛上有人似乎遇到了完全相同的问
我有如下嵌套资源:resources:categoriesdoresources:productsend根据RailsGuides,Youcanalsouseurl_forwithasetofobjects,andRailswillautomaticallydeterminewhichrouteyouwant:Inthiscase,Railswillseethat@magazineisaMagazineand@adisanAdandwillthereforeusethemagazine_ad_pathhelper.Inhelperslikelink_to,youcanspecifyju
如果params[:date]的参数为空,我希望我的text_field_tag将当前日期作为默认值,这是我目前的代码:我想要类似:谢谢 最佳答案 您可以简单地使用“或”运算符。如果params[:end]为空,它将使用Time.now。 关于ruby-on-rails-如果参数为空,则Text_field_tag默认值?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/35520