我在我的活动中使用了简单的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)
编辑:
我找到了解决方案here,从应用中移除了字体系列。但我用过如下。有没有办法删除edittext的字体?保持应用程序使用字体?
style-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>
答案 0 :(得分:2)
删除下一行:
<item name="android:fontFamily">sans-serif-light</item>
显然它在某些版本中不支持更改语言
答案 1 :(得分:0)
已修复
从主题-styles.xml中删除此行。此字体项目可能出现在App主题或活动主题或元素主题中。
<item name="android:fontFamily"> some fonts </item>
这对我有效,并且在较低的android版本中免于长按崩溃...对EditText和Material TextInputEditText均有效。