如何创建忘记密码页面?

时间:2019-06-16 19:57:12

标签: java android xml

我已经创建了一个登录页面和一个注册页面,它们看起来像代码中所示的一样,我想创建一个忘记密码页面,该页面可以从登录页面的按钮直接定向到我该怎么做。那?忘记密码页面应该是哪种活动?并且忘记密码还应该转到另一个页面,该页面向用户发送代码以确认帐户?

我尝试在.java文件中编写

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

但是它不起作用

  <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.ConstraintLayout 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.support.constraint.Guideline
            android:id="@+id/guideline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_begin="200dp"
            app:layout_constraintGuide_percent="0.3" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_begin="352dp"
            app:layout_constraintGuide_percent="0.9" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_begin="20dp"
            app:layout_constraintGuide_percent="0.1" />

        <ImageView
            android:id="@+id/lock"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline"
            app:layout_constraintEnd_toStartOf="@+id/guideline2"
            app:layout_constraintStart_toStartOf="@+id/guideline3"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/logo" />

        <EditText
            android:id="@+id/username"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:ems="10"
            android:hint="اسم المستخدم"
            android:inputType="textPersonName"
            app:layout_constraintEnd_toStartOf="@+id/guideline2"
            app:layout_constraintStart_toStartOf="@+id/guideline3"
            app:layout_constraintTop_toBottomOf="@+id/lock" />

        <EditText
            android:id="@+id/email"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:ems="10"
            android:hint="الايميل"
            android:inputType="textEmailAddress"
            app:layout_constraintEnd_toStartOf="@+id/guideline2"
            app:layout_constraintStart_toStartOf="@+id/guideline3"
            app:layout_constraintTop_toBottomOf="@+id/username" />

        <EditText
            android:id="@+id/password"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:ems="10"
            android:hint="كلمة السر"
            android:inputType="textPassword"
            app:layout_constraintEnd_toStartOf="@+id/guideline2"
            app:layout_constraintStart_toStartOf="@+id/guideline3"
            app:layout_constraintTop_toBottomOf="@+id/email" />

        <EditText
            android:id="@+id/confirmpassword"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:ems="10"
            android:hint="تأكيد كلمة السر"
            android:inputType="textPassword"
            app:layout_constraintEnd_toStartOf="@+id/guideline2"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="@+id/guideline3"
            app:layout_constraintTop_toBottomOf="@+id/password" />

        <ImageButton
            android:id="@+id/signup"
            android:layout_width="309dp"
            android:layout_height="66dp"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:src="@drawable/Creat-Account-button"
            app:layout_constraintEnd_toStartOf="@+id/guideline2"
            app:layout_constraintStart_toStartOf="@+id/guideline3"
            app:layout_constraintTop_toBottomOf="@+id/confirmpassword" />

        <ImageView
            android:id="@+id/footer"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginBottom="8dp"
            android:src="@drawable/footer-image"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/signup"
            app:layout_constraintVertical_bias="1.0"
            tools:layout_editor_absoluteX="0dp" />
    </android.support.constraint.ConstraintLayout>

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.ConstraintLayout
        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">


        <ImageView
            android:id="@+id/footer"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginBottom="8dp"
            android:src="@drawable/footer-image"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/signup"
            app:layout_constraintVertical_bias="1.0"
            app:srcCompat="@drawable/footer-image"
            tools:layout_editor_absoluteX="0dp" />

        <EditText
            android:id="@+id/username"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="32dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:hint="اسم المستخدم"
            android:inputType="textPersonName"
            app:layout_constraintEnd_toStartOf="@+id/guideline32"
            app:layout_constraintStart_toStartOf="@+id/guideline33"
            app:layout_constraintTop_toTopOf="@+id/guideline31" />

        <ImageView
            android:id="@+id/logo"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="8dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline31"
            app:layout_constraintEnd_toStartOf="@+id/guideline32"
            app:layout_constraintStart_toStartOf="@+id/guideline33"
            app:layout_constraintTop_toTopOf="parent"
            tools:srcCompat="@drawable/logo" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline31"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_begin="200dp"
            app:layout_constraintGuide_percent="0.3" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline32"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_begin="352dp"
            app:layout_constraintGuide_percent="0.9" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline33"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_begin="20dp"
            app:layout_constraintGuide_percent="0.1" />

        <EditText
            android:id="@+id/password"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:ems="10"
            android:hint="كلمة السر "
            android:inputType="textPassword"
            app:layout_constraintEnd_toStartOf="@+id/guideline32"
            app:layout_constraintStart_toStartOf="@+id/guideline33"
            app:layout_constraintTop_toBottomOf="@+id/username" />

        <ImageButton
            android:id="@+id/login"
            android:layout_width="0dp"
            android:layout_height="48dp"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            app:layout_constraintEnd_toStartOf="@+id/guideline32"
            app:layout_constraintHorizontal_bias="1.0"
            app:layout_constraintStart_toStartOf="@+id/guideline33"
            app:layout_constraintTop_toBottomOf="@+id/password"
            app:srcCompat="@drawable/Login-button" />

        <ImageButton
            android:id="@+id/forgetpassword"
            android:layout_width="0dp"
            android:layout_height="39dp"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            app:layout_constraintEnd_toStartOf="@+id/guideline32"
            app:layout_constraintStart_toStartOf="@+id/guideline33"
            app:layout_constraintTop_toBottomOf="@+id/login"
            app:srcCompat="@drawable/Forget-pass" />

        <ImageButton
            android:id="@+id/noaccount"
            android:layout_width="0dp"
            android:layout_height="39dp"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            app:layout_constraintEnd_toStartOf="@+id/guideline32"
            app:layout_constraintStart_toStartOf="@+id/guideline33"
            app:layout_constraintTop_toBottomOf="@+id/forgetpassword"
            app:srcCompat="@drawable/Dont-have-acc" />
    </android.support.constraint.ConstraintLayout>

0 个答案:

没有答案