**2制作登录界面1

Android Studio 是 Google 推出的 Android 应用程序开发工具包。在 Android Studio 中,您可以使用各种工具来设计和开发 Android 应用程序。如果您想要创建登录界面,可以使用 Android Studio 中的布局和组件来实现。

下面是一些基本步骤:

  1. 打开 Android Studio 并创建新项目。

  2. 在布局文件中添加一些组件,如文本输入框和按钮,用于用户输入用户名和密码。

  3. 编写 Java 代码来处理用户点击登录按钮时的逻辑。这可能包括验证用户名和密码,并在登录成功时显示另一个活动。

  4. 测试您的应用程序,确保登录界面正常工作。

 

textview  文本框

 

Gravity(重力)是 Android Studio(安卓开发工具)中的一个属性,可以用来控制一个视图在其父视图中的位置。通过设置 gravity 属性的值,可以让视图向上、向下、居中、靠左或靠右等方向偏移。这个属性常用于设计用户界面时,用来控制视图的布局。

 

效果图片

 

 

放源码吧还是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:padding="10dp"
    android:background="@drawable/sky"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/tv_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Yex-sir"
        android:textColor="@color/black"
        android:textSize="50dp"
        android:layout_marginTop="80dp"
        />

    <EditText
        android:id="@+id/et_1"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:textSize="30sp"
        android:textColor="#000000"
        android:hint="id"
        android:textColorHint="#63FFFFFF"
        android:maxLines="1"
        android:padding="5dp"
        android:layout_marginTop="5dp"
    />

    <EditText
        android:id="@+id/et_2"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="Password"
        android:maxLines="1"
        android:padding="5dp"
        android:textColor="@color/black"
        android:textColorHint="#63FFFFFF"
        android:textSize="30sp"
        android:inputType="textPassword"
        android:layout_marginTop="5dp"
        />


    <EditText
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="PIN"
        android:maxLines="1"
        android:padding="5dp"
        android:textColor="#000000"
        android:textColorHint="#63FFFFFF"
        android:textSize="30sp"
        android:layout_marginTop="5dp"
        />

    <Button
        android:id="@+id/btn_longin"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/longin"
        android:backgroundTint="@color/black"
        />


</LinearLayout>

 

posted @ 2023-04-06 15:53  YE-  阅读(88)  评论(0编辑  收藏  举报