#1
在 FireBase 实体后台数据库注册该软件,Android 开发 注册界面。
具体的FireBase 数据库注册很简单,不讲了。
看一下我们的布局界面:
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.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:background="#ffffff" tools:context=".Activity.RegisterActivity"> <ImageView android:id="@+id/imageView" android:layout_width="90dp" android:layout_height="90dp" android:layout_marginStart="8dp" android:layout_marginTop="40dp" android:layout_marginEnd="8dp" android:src="@drawable/userphoto" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layout_constraintGuide_percent="0.5" /> <EditText android:id="@+id/regName" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="65dp" android:layout_marginEnd="40dp" android:background="@drawable/reg_edittext_style" android:ems="10" android:hint="Name" android:inputType="textPersonName" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/imageView" /> <EditText android:id="@+id/regEmail" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="8dp" android:layout_marginEnd="40dp" android:layout_marginBottom="4dp" android:background="@drawable/reg_edittext_style" android:ems="10" android:hint="Email" android:inputType="textPersonName" app:layout_constraintBottom_toTopOf="@+id/regPassword" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/regName" /> <EditText android:id="@+id/regPassword" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="8dp" android:layout_marginEnd="40dp" android:background="@drawable/reg_edittext_style" android:ems="10" android:hint="Password" android:inputType="textPassword" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/regEmail" /> <EditText android:id="@+id/regRePassword" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="8dp" android:layout_marginEnd="40dp" android:background="@drawable/reg_edittext_style" android:ems="10" android:hint="Password" android:inputType="textPassword" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/regPassword" /> <Button android:id="@+id/regBtn" android:layout_width="130dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="48dp" android:layout_marginEnd="8dp" android:background="@drawable/reg_btn_style" android:text="Register" android:textColor="#fff" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.498" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/regRePassword" /> <ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBottom_toBottomOf="@+id/regBtn" app:layout_constraintEnd_toEndOf="@+id/regBtn" app:layout_constraintStart_toStartOf="@+id/regBtn" app:layout_constraintTop_toTopOf="@+id/regBtn" /> </androidx.constraintlayout.widget.ConstraintLayout>
然后看看我们的控件背景布局如何操作:
reg_btn_style.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="@color/colorPrimaryDark" /> <corners android:radius="20dp"/> </shape>
reg_edittext_style.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#E9E9E9" /> <corners android:radius="40dp" /> <padding android:bottom="10dp" android:left="15dp" android:right="15dp" android:top="10dp" /> </shape>
来源:https://www.cnblogs.com/cao-1/p/12301200.html