Ich bin sehr neu in Android-Entwicklung. Ich weiß, dass es im Stapelüberlauf viele Fragen wie diese gibt. Ich habe diese Fragen gestellt, aber ich habe noch keine Lösung gefunden. Immer wenn ich lange auf die EditText
, die innerhalb TextInputLayout
App Crash ist, drücken.Schwerwiegende Ausnahme: android.view.InflateException: Binär XML-Datei Zeile # 20
Fatal Exception: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class TextView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.view.View.inflate(View.java:19805)
at android.widget.Editor.getTextThumbnailBuilder(Editor.java:2112)
at android.widget.Editor.performLongClick(Editor.java:1014)
at android.widget.TextView.performLongClick(TextView.java:9240)
at android.view.View$CheckForLongPress.run(View.java:21142)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by android.view.InflateException: Binary XML file line #20: Error inflating class TextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.view.View.inflate(View.java:19805)
at android.widget.Editor.getTextThumbnailBuilder(Editor.java:2112)
at android.widget.Editor.performLongClick(Editor.java:1014)
at android.widget.TextView.performLongClick(TextView.java:9240)
at android.view.View$CheckForLongPress.run(View.java:21142)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by java.lang.UnsupportedOperationException: Failed to resolve attribute at index 24: TypedValue{t=0x3/d=0x285 "res/color/primary_text_material_light.xml" a=1 r=0x106010a}
at android.content.res.TypedArray.getColor(TypedArray.java:447)
at android.widget.TextView.<init>(TextView.java:738)
at android.widget.TextView.<init>(TextView.java:671)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1031)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:746)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.view.View.inflate(View.java:19805)
at android.widget.Editor.getTextThumbnailBuilder(Editor.java:2112)
at android.widget.Editor.performLongClick(Editor.java:1014)
at android.widget.TextView.performLongClick(TextView.java:9240)
at android.view.View$CheckForLongPress.run(View.java:21142)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by android.view.InflateException
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:782)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)
Caused by java.lang.UnsupportedOperationException
android.content.res.TypedArray.getColor (TypedArray.java:447)
android.widget.TextView.<init> (TextView.java:738)
android.widget.TextView.<init> (TextView.java:671)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)
Meine XML-Datei:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/sign_in_relative_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/sign_in_bg"
class = "com.fitficfitz.android.ui.login.SignInFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@color/colorPrimary"
android:paddingLeft="@dimen/size_5"
>
<ImageView
android:id="@+id/backButton"
android:layout_width="@dimen/size_20"
android:layout_height="@dimen/size_20"
android:layout_marginLeft="@dimen/size_10"
android:src="@drawable/back_btn"/>
<TextView
android:id="@+id/more_session_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIGN IN"
android:textStyle="normal"
android:textSize="24sp"
android:textColor="@color/white"
android:paddingLeft="@dimen/size_30"
/>
<include
android:id="@+id/book_toolbar"
layout="@layout/book_session_toolbar"/>
</LinearLayout>
<LinearLayout
android:id="@+id/social_sign_in_linear_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/size_126"
android:orientation="horizontal"
android:layout_marginTop="@dimen/size_50">
<FrameLayout
android:id="@+id/twitter_sign_in"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="@dimen/weight_1"
android:visibility="gone">
<TextView
android:id="@+id/twitter_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="@dimen/size_10"
android:drawableTop="@drawable/twitter"
android:gravity="center"
android:letterSpacing="@dimen/letter_spacing_040"
android:text="@string/login_with_twitter"
android:textColor="@color/white"
android:textSize="@dimen/font_13"
tools:ignore="UnusedAttribute"/>
</FrameLayout>
<View
android:id="@+id/social_divider_view"
android:layout_width="@dimen/size_1"
android:layout_height="@dimen/size_126"
android:alpha="0.2"
android:visibility="gone"
android:background="@color/grey_eff6fc"/>
<FrameLayout
android:id="@+id/facebook_sign_in"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="@dimen/weight_1">
<TextView
android:id="@+id/facebook_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="@dimen/size_10"
android:drawableTop="@drawable/facebook"
android:gravity="center"
android:letterSpacing="@dimen/letter_spacing_040"
android:text="@string/login_in_with_facebook"
android:textColor="@color/white"
android:textSize="@dimen/font_13"
tools:ignore="UnusedAttribute"/>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/social_horizontal_divider_view"
android:layout_width="match_parent"
android:layout_height="@dimen/size_1"
android:layout_below="@+id/social_sign_in_linear_layout"
android:layout_marginBottom="@dimen/size_50"
android:alpha="0.2"
android:background="@color/grey_eff6fc"/>
<ImageView
android:id="@+id/username_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/social_horizontal_divider_view"
android:layout_marginBottom="@dimen/size_20"
android:layout_marginLeft="@dimen/size_28"
android:layout_marginRight="@dimen/size_28"
android:contentDescription="@null"
android:src="@drawable/username"
android:layout_marginTop="@dimen/size_25"/>
<android.support.design.widget.TextInputLayout
android:theme="@style/TextLabel"
android:id="@+id/input_layout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/username_image_view"
android:layout_toRightOf="@id/username_image_view"
android:layout_marginTop="@dimen/size_10"
android:layout_below="@+id/social_horizontal_divider_view">
<EditText
android:layout_marginTop="10dp"
android:id="@+id/username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="Email Address"
android:inputType="textEmailAddress"
android:paddingBottom="@dimen/size_16"
android:translationY="10dp"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="@dimen/font_13"/>
</android.support.design.widget.TextInputLayout>
<View
android:id="@+id/username_base_view"
android:layout_width="wrap_content"
android:layout_height="@dimen/size_1"
android:layout_alignLeft="@id/input_layout_username"
android:layout_alignParentRight="true"
android:layout_below="@id/input_layout_username"
android:alpha="0.2"
android:background="@color/grey_eff6fc"
android:paddingBottom="@dimen/size_10"/>
<ImageView
android:id="@+id/password_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/username_base_view"
android:layout_marginTop="@dimen/size_30"
android:contentDescription="@null"
android:paddingBottom="@dimen/size_20"
android:paddingLeft="@dimen/size_28"
android:paddingRight="@dimen/size_28"
android:src="@drawable/password"
/>
<android.support.design.widget.TextInputLayout
android:theme="@style/TextLabel"
android:id="@+id/input_layout_passwrod"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/username_base_view"
android:layout_toEndOf="@id/password_image_view"
android:layout_marginTop="@dimen/size_10"
android:layout_toRightOf="@id/password_image_view">
<EditText
android:id="@+id/password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/password"
android:inputType="textPassword"
android:paddingBottom="@dimen/size_16"
android:paddingTop="@dimen/size_10"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="@dimen/font_13"
/>
</android.support.design.widget.TextInputLayout>
<ImageView
android:id="@+id/forgot_password_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/username_base_view"
android:layout_marginEnd="@dimen/size_20"
android:layout_marginRight="@dimen/size_20"
android:layout_marginTop="@dimen/size_30"
android:clickable="true"
android:src="@drawable/forgot_password"/>
<View
android:id="@+id/password_base_view"
android:layout_width="wrap_content"
android:layout_height="@dimen/size_1"
android:layout_alignLeft="@id/input_layout_passwrod"
android:layout_alignParentRight="true"
android:layout_below="@id/input_layout_passwrod"
android:alpha="0.2"
android:background="@color/grey_eff6fc"/>
<Button
android:id="@+id/sign_in_button"
style="@style/EndButtonStyle"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/size_32"
android:text="@string/sign_in_button"/>
<LinearLayout
android:id="@+id/sign_up_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/sign_in_button"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/sign_up_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sign_up_text"
android:textColor="@color/grey_a8a9ab"
android:textSize="@dimen/font_13"/>
<TextView
android:id="@+id/sign_up_question_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_4"
android:clickable="true"
android:text="@string/sign_up_question"
android:textColor="@color/grey_a8a9ab"
android:textSize="@dimen/font_14"/>
</LinearLayout>
<FrameLayout
android:id="@+id/login_progress_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="@dimen/alpha_04"
android:background="@color/black"
android:clickable="true"
android:focusable="true"
android:visibility="gone">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</FrameLayout>
</RelativeLayout>
primary_text_material_light.xml Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/primary_text_disabled_material_light"/>
<item android:color="@color/primary_text_default_material_light"/>
</selector>
style/Textlabel Code:
<style name="TextLabel" parent="TextAppearance.AppCompat">
<item name="android:textColorHint">@color/white</item>
<item name="colorAccent">@color/white</item>
<item name="colorControlNormal">@color/white</item>
<item name="colorControlActivated">@color/white</item>
</style>
Zeigen Sie den XML-Code. –
Wo ist der Code für 'primary_text_material_light.xml'? –
@KNeerajLal Ich habe den Code geteilt. Überprüfe es bitte. –