android ui登录界面

  登录界面

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:orientation="vertical"
    tools:context="com.example.administrator.myapplication.MainActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:orientation="horizontal">
        <TextView
            android:textColor="#ffffff"
            android:text="登录"
            android:textSize="20dp"
            android:gravity="center"
            android:background="#0099ff"
            android:layout_width="match_parent"
            android:layout_height="44dp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:paddingTop="16dp">
        <EditText
            android:id="@+id/zhangHaoText"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:hint="帐号"
            android:numeric="integer"
            android:textColorHint="#0066ff"
            android:maxLength="11"
            android:background="@drawable/edit_shape"/>

        <EditText
            android:id="@+id/miMaText"
            android:layout_marginTop="10dp"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:hint="密码"
            android:maxLength="16"
            android:textColorHint="#0066ff"
            android:background="@drawable/edit_shape"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginTop="10dp">

            <Button
                android:id="@+id/zhuCeButton"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#0000"
                android:text="注册"
                android:textColor="#0066ff"
                android:gravity="left|center"/>
            <Button
                android:id="@+id/wangJiMiMaButton"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#0000"
                android:text="忘记密码"
                android:textColor="#0066ff"
                android:gravity="right|center"/>


        </LinearLayout>

        <Button
            android:id="@+id/dengLuButton"
            android:layout_marginTop="10dp"
            android:layout_width="match_parent"
            android:layout_height="44dp"
            android:text="登录"
            android:background="@drawable/shape"
            android:textColor="#ffffff"
            android:textSize="15dp"/>

    </LinearLayout>


</LinearLayout>

zhu'c

微信关注 “安卓集中营”,获取更多

或者扫码关注

一起共同学习探讨

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android Studio 登陆界面的代码主要包括以下几个方面: 1. 布局文件:登陆界面的布局文件通常采用 XML 格式,通过布局文件中的各种控件来实现 UI 界面的展示和交互。 2. 控制器代码:登陆界面需要与用户进行交互,通过控制器代码来实现与布局文件的交互逻辑。 3. 模型代码:登陆界面需要进行数据的验证和存储,通过模型代码来实现对数据的操作。 下面是一个简单的登陆界面代码示例: 1. 布局文件 login.xml ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <EditText android:id="@+id/editText_email" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Email" /> <EditText android:id="@+id/editText_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Password" android:inputType="textPassword" /> <Button android:id="@+id/button_login" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Log in" /> </LinearLayout> ``` 2. 控制器代码 LoginController.java ``` public class LoginController extends AppCompatActivity { private EditText mEditTextEmail; private EditText mEditTextPassword; private Button mButtonLogin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mEditTextEmail = findViewById(R.id.editText_email); mEditTextPassword = findViewById(R.id.editText_password); mButtonLogin = findViewById(R.id.button_login); mButtonLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String email = mEditTextEmail.getText().toString(); String password = mEditTextPassword.getText().toString(); // TODO: 进行数据验证 // TODO: 进行登陆操作 } }); } } ``` 3. 模型代码 LoginModel.java ``` public class LoginModel { private String mEmail; private String mPassword; public LoginModel(String email, String password) { mEmail = email; mPassword = password; } public boolean isEmailValid() { // TODO: 进行邮箱格式验证 return true; } public boolean isPasswordValid() { // TODO: 进行密码格式验证 return true; } public boolean login() { // TODO: 进行登陆操作 return true; } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值