Every time I add widgets or stuff, below exception always occurs, so I can't even run my project. What causes this problem? What is the solution? I'm very new to Android Studio, and I hope you guys will help me. Every answer of you will be my pleasure. Thanks!
Here is my Layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.leeroyld.testproject.MainActivity">
<Button
android:text="@string/LoginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:layout_marginBottom="79dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@android:color/background_dark"
android:backgroundTint="@android:drawable/bottom_bar"
android:textColor="@android:color/background_light" />
<TextView
android:text="@string/LoginLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/EmailDisplay"
android:textSize="24sp"
android:layout_below="@+id/textView"
android:layout_alignParentStart="true"
android:layout_marginTop="36dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/PasswordInput"
tools:ignore="LabelFor"
android:layout_marginBottom="42dp"
android:layout_above="@+id/button"
android:layout_centerHorizontal="true"
android:background="?attr/actionModeBackground" />
<TextView
android:text="@string/PasswordLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/PasswordDisplay"
android:textSize="24sp"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
<TextView
android:text="@string/TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:textSize="24sp"
android:layout_marginTop="31dp"
android:background="@android:drawable/button_onoff_indicator_on"
android:backgroundTint="@android:drawable/alert_light_frame"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/EmailInput"
tools:ignore="LabelFor"
android:layout_marginTop="24dp"
android:background="?attr/actionModeBackground"
android:layout_below="@+id/EmailDisplay"
android:layout_alignStart="@+id/PasswordInput" />
</RelativeLayout>
Remove the android:backgroundTint
from LoginButton
and TextView
. Your final layout should look like this.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="79dp"
android:background="@android:color/background_dark"
android:text="Login"
android:textColor="@android:color/background_light" />
<TextView
android:id="@+id/EmailDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_marginTop="36dp"
android:text="Email"
android:textSize="24sp" />
<EditText
android:id="@+id/PasswordInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button"
android:layout_centerHorizontal="true"
android:layout_marginBottom="42dp"
android:background="?attr/actionModeBackground"
android:ems="10"
android:inputType="textPassword"
tools:ignore="LabelFor" />
<TextView
android:id="@+id/PasswordDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Password"
android:textSize="24sp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="31dp"
android:background="@android:drawable/button_onoff_indicator_on"
android:text="TextView"
android:textSize="24sp" />
<EditText
android:id="@+id/EmailInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/EmailDisplay"
android:layout_marginTop="24dp"
android:background="?attr/actionModeBackground"
android:ems="10"
android:inputType="textEmailAddress"
tools:ignore="LabelFor" />
</RelativeLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.