我Edit Text
在我的活动中使用了简单,如下所示。我尝试了堆栈和其他资源的不同解决方案,但它并没有解决我的问题。
<EditText
android:id="@+id/edtRemarks"
android:layout_width="match_parent"
android:layout_height="80dip"
android:gravity="left|top"
android:hint="Enter comments1"
android:padding="5dp"
android:textSize="16sp"
android:textStyle="normal" />
长按出现以下错误
android.view.InflateException: Binary XML file line #17: Error inflating class TextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:2928)
at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2233)
at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:2901)
at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:2901)
at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3302)
at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3536)
at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3780)
at android.widget.Editor.performLongClick(Editor.java:866)
at android.widget.TextView.performLongClick(TextView.java:8660)
at android.view.View$CheckForLongPress.run(View.java:19723)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=1552
at android.content.res.StringBlock.get(StringBlock.java:65)
at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:967)
at android.content.res.TypedArray.getString(TypedArray.java:176)
at android.widget.TextView.<init>(TextView.java:1011)
at android.widget.TextView.<init>(TextView.java:629)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:48)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:44)
at android.support.v7.internal.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:912)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:966)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:2928)
at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2233)
at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:2901)
at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:2901)
at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3302)
at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3536)
at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3780)
at android.widget.Editor.performLongClick(Editor.java:866)
at android.widget.TextView.performLongClick(TextView.java:8660)
at android.view.View$CheckForLongPress.run(View.java:19723)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
知道为什么这只发生在 5.0.1 和 5.0.2 中吗?它在 <= KITKAT 设备中运行良好。
编辑:
我在这里找到了解决方案,从应用程序中删除字体系列。但我用过如下。有没有办法只删除edittext的字体?保持应用程序使用字体?
values-v21 文件夹中的 style.xml
<style name="AppTheme" parent="AppTheme.Bash">
<item name="homeAsUpIndicator">@null</item>
<item name="android:homeAsUpIndicator">@null</item>
<item name="actionBarStyle">@style/CustomActionBarStyle</item>
<item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
<item name="android:fontFamily">sans-serif-light</item>
</style>