长按EditText时应用程序崩溃 - 仅在5.0.1和5.0.2中

问题描述 投票:-2回答:1

我在我的活动中使用了简单的qazxsw poi,如下所示。我尝试过堆栈和其他资源的不同解决方案,但它并没有解决我的问题。

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" />

知道为什么只在5.0.1和5.0.2中发生这种情况吗?它在<= KITKAT设备中正常工作。

编辑:

我发现解决方案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)  ,从应用程序中删除字体系列。但我用过如下。有没有办法删除edittext的字体?保持应用程序使用字体?

value-v21文件夹中的style.xml

here
android android-edittext android-5.0-lollipop android-5.1.1-lollipop
1个回答
2
投票

删除下一行:

<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>

显然它在某些版本中不支持更改语言

© www.soinside.com 2019 - 2024. All rights reserved.