实际上我尝试了所有的东西,并且经历了很多堆栈溢出,但是当时没有回答请帮助我!
这是XML代码
`<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="@color/background"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="56dp"
tools:context="com.example.aka.gism.all_activity.Login_Screen">
<ImageView
android:layout_width="wrap_content"
android:layout_height="87dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/_24sdp"
android:paddingBottom="15sp"
android:paddingLeft="15sp"
android:paddingRight="15sp"
android:paddingTop="15sp"
android:src="@drawable/bs" />
<!-- Email Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_8sdp"
android:layout_marginTop="@dimen/_8sdp"
android:theme="@style/Login_Text">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/input_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="User Name"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textColor="@color/third_color"
android:textStyle="italic" />
</android.support.design.widget.TextInputLayout>
<!-- Password Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_8sdp"
android:layout_marginTop="@dimen/_8sdp"
android:theme="@style/Login_Text">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="Password"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="@color/third_color"
android:textStyle="italic" />
</android.support.design.widget.TextInputLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btn_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/gradient_background"
android:padding="12dp"
android:text="Login"
android:textColor="@color/second_color" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:padding="@dimen/_6sdp"
android:text="Powered By"
android:textAlignment="center"
android:textSize="@dimen/_10sdp"
tools:ignore="RtlCompat" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity=""
android:layout_weight="1"
android:padding="@dimen/_6sdp"
android:text="Glint Logic"
android:textAlignment="center"
android:textAllCaps="true"
android:textColor="@color/colorLight"
android:textSize="@dimen/_15sdp"
android:textStyle="bold|normal"
tools:ignore="RtlCompat" />
</LinearLayout>
`
现在这是错误的 这是我在5.0设备中安装时遇到的错误,但它在我的设备中工作是7.0。我更改了我的apk并刷新了gradle,但没有任何工作,只需在我的设备中执行时停止。
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.aka.gism/com.example.aka.gism.all_activity.Login_Screen}: android.view.InflateException: Binary XML file line #0: Error inflating class EditText
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2321)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2381)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5260)
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: android.view.InflateException: Binary XML file line #0: Error inflating class EditText
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
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.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.aka.gism.all_activity.Login_Screen.onCreate(Login_Screen.java:107)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2274)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2381)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5260)
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.RuntimeException: Failed to resolve attribute at index 96
at android.content.res.TypedArray.getColor(TypedArray.java:401)
at android.widget.TextView.<init>(TextView.java:717)
at android.widget.EditText.<init>(EditText.java:71)
at android.widget.EditText.<init>(EditText.java:63)
at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:64)
at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:60)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:112)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1016)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1073)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
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.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.aka.gism.all_activity.Login_Screen.onCreate(Login_Screen.java:107)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2274)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2381)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5260)
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)