Android XML错误膨胀类TextView

时间:2018-12-24 05:25:42

标签: android xml android-studio android-layout textview

我的xml文件中的所有文本视图导致应用崩溃。我是Android新手。我的应用程序没有操作栏。 logcat错误指向xml中的每个textView。 请告诉我哪里出了问题?如果您需要更多信息,请发表评论。帮助帮助帮助帮助

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
android:theme="@style/Base.TextAppearance.AppCompat.Button"
tools:context=".login_Activity">

<RelativeLayout
    android:id="@+id/layer1"
    android:layout_width="match_parent"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_height="wrap_content"
    android:layout_margin="10dp">

    <ImageView
        android:id="@+id/logo_img"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:adjustViewBounds="true"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_party_mode_black_24dp" />

    <RelativeLayout
        android:id="@+id/layer2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/logo_img">

      <TextView
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:id="@+id/loginTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-condensed"
            android:text="Login"
            android:textColor="@color/colorPrimary"
            android:textSize="25dp" />

        <LinearLayout
            android:id="@+id/layer3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/loginTxt"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:padding="10dp"
                android:text="User Name"
                android:textColor="@color/gdStart"
                android:textSize="18dp" />

            <EditText
                android:inputType="text"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/text_bg"
                android:textColor="@color/colorPrimary"
                android:textSize="18dp" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/layer4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/loginTxt"
            android:layout_marginTop="70dp"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:padding="10dp"
                android:text="Password"
                android:textColor="@color/gdStart"
                android:textSize="18dp" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/text_bg"
                android:textColor="@color/colorPrimary"
                android:textSize="18dp" />
        </LinearLayout>

        <Button
            android:layout_marginTop="20dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layer4"
            android:layout_centerHorizontal="true"
            android:text="Submit"
            android:background="@color/colorPrimary"
            android:textColor="@color/gdStart" />

    </RelativeLayout>


</RelativeLayout>

Logcat错误

 2018-12-24 10:45:10.884 11671-11671/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sumanmsoft.forwardz, PID: 11671
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sumanmsoft.forwardz/com.sumanmsoft.forwardz.login_Activity}: android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class TextView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
 Caused by: android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class TextView
 Caused by: android.view.InflateException: Binary XML file line #33: Error inflating class TextView
 Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 4: TypedValue{t=0x2/d=0x1010099 a=1}
    at android.content.res.TypedArray.getColor(TypedArray.java:485)
    at android.widget.TextView.<init>(TextView.java:822)
    at android.widget.TextView.<init>(TextView.java:746)
    at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:87)
    at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:83)
    at android.support.v7.app.AppCompatViewInflater.createTextView(AppCompatViewInflater.java:177)
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102)
    at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
    at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:738)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:832)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:872)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:832)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:872)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:832)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
    at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    at com.sumanmsoft.forwardz.login_Activity.onCreate(login_Activity.java:11)
    at android.app.Activity.performCreate(Activity.java:6915)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

在此处输入代码

0 个答案:

没有答案