问题描述
我在实时应用中看到此错误,因此我不知道为什么会发生这种情况。我只有这个异常日志(见下文)。
起初,我以为我将样式editTextBackgroungWhite(见下文)应用到我的XML中的editText,但删除它对问题没有影响。
I am seeing this error in a live app thus I have no clue why this happening. All I have is this exception log (see below).At first, I thought I applied style editTextBackgroungWhite(see below)to the editText inside my XML but removing it has no effect on the problem.
我'如果有人可以引导我走向正确的方向,我会很高兴。
I'll be glad if someone could guide me towards the right direction.
PS我无法在我的设备上复制这个bug似乎是一些三星音符系列的问题仅限设备。
P.S I am not able to replicate this bug on my device seems that it's a problem with some Samsung note series device only.
<style name="editTextBackgWhite"parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#ffffff</item>
<item name="colorControlActivated">#ffffff</item>
<item name="colorControlHighlight">#ffffff</item>
</style>
Fatal Exception: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:484)
at android.text.style.TextAppearanceSpan.(TextAppearanceSpan.java)
at android.text.style.TextAppearanceSpan.(TextAppearanceSpan.java)
at android.widget.Editor$SuggestionsPopupWindow$SuggestionInfo.(Editor.java)
at android.widget.Editor$SuggestionsPopupWindow$SuggestionInfo.(Editor.java)
at android.widget.Editor$SuggestionsPopupWindow.initContentView(Editor.java:2995)
at android.widget.Editor$PinnedPopupWindow.(Editor.java)
at android.widget.Editor$SuggestionsPopupWindow.(Editor.java)
at android.widget.Editor.showSuggestions(Editor.java:2229)
at android.widget.Editor$2.run(Editor.java:2109)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
推荐答案
使用AutoCompleteTextView时有完全相同的异常。复制真的很艰难,在我的这两天浪费了。
Had exact same exception while using AutoCompleteTextView. Replication was really tough and wasted my two days in this.
原因是 Google拼写检查弹出,在某些设备中启用了导致在Edittext / AutoCompleteEdittext中的单词下面的红线并单击它会打开一个拼写建议的弹出窗口。根据我的观察,这个弹出窗口在TextInputLayout(带有样式)方面不太顺利,并导致某些设备崩溃(在我的情况下是Moto G播放)。你可以通过关闭Google拼写检查来验证它,它会正常工作。
但真正的解决方案是添加
The cause for this is Google spell checker popup, enabled in some devices which causes red line under words in Edittext/AutoCompleteEdittext and clicking on it opens a popup of spell suggestions. According to my observations this popup doesn't go too well in TextInputLayout(with style) and causes crash in some devices (in my case it was Moto G play). You can verify it by turning off the Google spell checker and it will work fine.But the real solution is to add
android:inputType =textNoSuggestions
以XML格式编辑您的edittext
to your edittext in XML
这会禁用该edittext的拼写检查工具,其余工作正常。
This disables the spell checker for that edittext and rest works fine.
如果有帮助,请告诉我。
Let me know if it helped.
这篇关于致命异常:java.lang.UnsupportedOperationException:无法解析索引6处的属性:TypedValue {t = 0x2 / d = 0x101009b a = 1}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!