gpt4 book ai didi

android.view.InflateException : Error inflating class android. widget.EditText 华硕安卓 5

转载 作者:太空宇宙 更新时间:2023-11-03 13:10:59 24 4
gpt4 key购买 nike

我不断收到有关此崩溃发生的报告,但它只发生在装有 android 5 的华硕设备上,如下图所示 report

那是堆栈跟踪:

    Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my_package/com.my_package.activities.SignInActivity}: android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.EditText
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5264)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Caused by android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.EditText
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.view.View.inflate(View.java:18427)
at com.my_package.activities.SignInActivity.onCreate(SignInActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5264)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.view.View.inflate(View.java:18427)
at com.my_package.activities.SignInActivity.onCreate(SignInActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5264)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Caused by java.lang.RuntimeException: Failed to resolve attribute at index 96
at android.content.res.TypedArray.getColor(TypedArray.java:401)
at android.widget.TextView.<init>(TextView.java:714)
at android.widget.EditText.<init>(EditText.java:65)
at android.widget.EditText.<init>(EditText.java:61)
at android.widget.EditText.<init>(EditText.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.view.View.inflate(View.java:18427)

SignInActivity.java

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);

llSignInContainer = (LinearLayout) findViewById(R.id.llSignInContainer);
llSignInContainer.addView(View.inflate(this, R.layout.sign_in_form, null)); // <-- Line 52
}

sign_in_form.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_below="@+id/rlTop"
android:background="@android:color/white"
android:orientation="vertical"
android:padding="@dimen/activity_horizontal_margin">

<TextView
android:id="@+id/tvHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:padding="@dimen/edit_text_padding"
android:text="@string/type_data_to_access_central"
android:textColor="@color/mediumGray" />

<android.support.design.widget.TextInputLayout
android:id="@+id/inputEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/TextInputStyle"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
app:passwordToggleEnabled="false">

<EditText // -- This is line 29 --
android:id="@+id/etEmail"
style="@style/FormEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/your_email"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>

在其他设备上它运行良好,我用 Android 4.3 和 6.0 的华硕设备进行了测试,它也运行良好。

最佳答案

正如这个答案的评论所说 https://stackoverflow.com/a/30914037/5178257问题出在主题上,因此如果您将父主题设置为 ThemeOverlay.AppCompat.Light,它将解决 ASUS 设备上的崩溃问题。

例如

<style name="TextInputStyle" parent="ThemeOverlay.AppCompat.Light">
<item name="android:textColorHint">@color/black</item>
<item name="colorControlActivated">@color/gray</item>
</style>

关于android.view.InflateException : Error inflating class android. widget.EditText 华硕安卓 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45083265/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com