Вот код XML для виджета EditText , который вызывает ошибку.Я думаю, что ошибка связана с версией Android моего телефона (Lollipop 5.1).
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:hint="UserName"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/rounded_border_edittext"
android:padding="8dp"
android:inputType="text"
android:id="@+id/userName"/>
Ниже приведен код активности запуска приложения, которая является активностью входа в систему.Вот файл complete xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/DFO"
android:fontFamily="@font/dreschergroteskbtsmallsizes"
android:textStyle="normal"
android:textSize="18sp"
android:textColor="@color/colorPrimaryDark"
android:layout_marginTop="80dp"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/string1"
android:textSize="16sp"
android:fontFamily="@font/dreschergroteskbtsmallsizes"
android:textStyle="bold"
android:textColor="#3FDDFD"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/string2"
android:textSize="18sp"
android:fontFamily="@font/dreschergroteskbtsmallsizes"
android:textStyle="bold"
android:textColor="#3FDDFD"
android:layout_gravity="center"/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:hint="UserName"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/rounded_border_edittext"
android:padding="8dp"
android:inputType="text"
android:id="@+id/userName"/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_border_edittext"
android:hint="Password"
android:inputType="numberPassword"
android:padding="8dp"
android:id="@+id/password"/>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:text="Save"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textAllCaps="false"
android:textSize="20sp"
android:textStyle="bold"
android:fontFamily="@font/dreschergroteskbtsmallsizes"
android:background="@drawable/rounded_border_button"
android:id="@+id/saveBtn"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<LinearLayout
android:layout_width="130dp"
android:layout_height="18dp"
android:layout_marginLeft="60dp"
android:background="#DE1D1D"
android:id="@+id/redStrip"
android:orientation="horizontal"/>
<LinearLayout
android:layout_width="130dp"
android:layout_height="18dp"
android:layout_marginRight="60dp"
android:background="#3FDDFD"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@+id/redStrip"
android:orientation="horizontal"/>
<LinearLayout
android:layout_width="160dp"
android:layout_height="18dp"
android:background="#F3F333"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_below="@+id/redStrip"
android:orientation="horizontal"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/string3"
android:textSize="18sp"
android:layout_marginTop="15dp"
android:fontFamily="@font/dreschergroteskbtsmallsizes"
android:textStyle="bold"
android:textColor="#3FDDFD"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/powered"
android:textSize="16sp"
android:fontFamily="@font/dreschergroteskbtsmallsizes"
android:textStyle="bold"
android:textColor="#4C4C43"
android:layout_gravity="center"/>
</LinearLayout>
Это действие запуска приложения.Приложение вылетает при запуске этого действия.Вот это logcat :
06-13 10:20:02.321 31384-31384/com.journalfdwb.digitizedjournalmanagement E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.journalfdwb.digitizedjournalmanagement, PID: 31384
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.journalfdwb.digitizedjournalmanagement/com.journalfdwb.digitizedjournalmanagement.LoginPage}: android.view.InflateException: Binary XML file line #34: Error inflating class EditText
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2521)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
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:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Caused by: android.view.InflateException: Binary XML file line #34: Error inflating class EditText
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
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.journalfdwb.digitizedjournalmanagement.LoginPage.onCreate(LoginPage.java:20)
at android.app.Activity.performCreate(Activity.java:6092)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
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:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Caused by: android.content.res.Resources$NotFoundException: Resource "com.journalfdwb.digitizedjournalmanagement:drawable/rounded_border_edittext" (7f070078) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f070078 a=-1 r=0x7f070078}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2690)
at android.content.res.Resources.loadDrawable(Resources.java:2614)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.view.View.<init>(View.java:3795)
at android.widget.TextView.<init>(TextView.java:663)
at android.widget.EditText.<init>(EditText.java:70)
at android.widget.EditText.<init>(EditText.java:66)
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.createEditText(AppCompatViewInflater.java:191)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:113)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1035)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
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.journalfdwb.digitizedjournalmanagement.LoginPage.onCreate(LoginPage.java:20)
at android.app.Activity.performCreate(Activity.java:6092)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
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:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)