<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"
    tools:context=".MainActivity">

    <!-- 账号 -->
    <TextView
        android:id="@+id/accountLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="账号:"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/accountInput"
        app:layout_constraintHorizontal_chainStyle="packed" />

    <EditText
        android:id="@+id/accountInput"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:hint="QQ/Phone"
        app:layout_constraintTop_toTopOf="@id/accountLabel"
        app:layout_constraintStart_toEndOf="@id/accountLabel"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginStart="8dp"/>

    <!-- 密码 -->
    <TextView
        android:id="@+id/passwordLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="密码:"
        app:layout_constraintTop_toBottomOf="@id/accountLabel"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/passwordInput"
        android:layout_marginTop="16dp"/>

    <EditText
        android:id="@+id/passwordInput"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:hint="Password"
        app:layout_constraintTop_toTopOf="@id/passwordLabel"
        app:layout_constraintStart_toEndOf="@id/passwordLabel"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginStart="8dp"/>

    <!-- 班级 -->
    <TextView
        android:id="@+id/classLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="班级:"
        app:layout_constraintTop_toBottomOf="@id/passwordLabel"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/classSpinner"
        android:layout_marginTop="16dp"/>

    <Spinner
        android:id="@+id/xclass"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toTopOf="@id/classLabel"
        app:layout_constraintStart_toEndOf="@id/classLabel"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginStart="8dp"/>

    <!-- 登录按钮 -->
    <Button
        android:id="@+id/loginButton"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="登录"
        app:layout_constraintTop_toBottomOf="@id/classLabel"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginTop="16dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

 
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">
        <!-- Line 1 -->
        <LinearLayout 
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center"
            android:orientation="horizontal">
            <TextView 
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="账号:"/>
            <EditText android:layout_width="200sp"
                android:layout_height="wrap_content"
                android:hint="QQ/Phone"/>
        </LinearLayout>
        
        
       <!-- Line2 -->
       <LinearLayout 
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center"
           android:orientation="horizontal">
           <TextView 
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="密码:"/>
           <EditText 
               android:layout_width="200sp"
               android:layout_height="wrap_content"
              />
       </LinearLayout>
       
       
       <!-- Line3 -->
       <LinearLayout 
           android:layout_height="wrap_content"
           android:layout_width="wrap_content"
           android:layout_gravity="center"
           android:orientation="horizontal">
           <TextView 
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="班级:"/>
           <Spinner 
               android:id="@+id/xclass"
               android:layout_width="200sp"
               android:layout_height="wrap_content"/>
       </LinearLayout>
       
       <!-- Line4 -->
       <LinearLayout 
           android:layout_height="wrap_content"
           android:layout_width="wrap_content"
           android:layout_gravity="center"
           android:orientation="horizontal">
           <Button android:layout_width="200sp"
               android:layout_height="wrap_content"
               android:text="登录"/>
           
           
           
       </LinearLayout>
       
      
    </LinearLayout>
</RelativeLayout>
最后修改:2025 年 03 月 13 日
如果觉得我的文章对你有用,请随意赞赏