Android——XUtils3实现登录和注册页面校验,正则验证

本文介绍了如何使用XUtils3在Android中进行登录和注册页面的验证,通过正则表达式确保输入数据的有效性。内容涵盖了项目的初始化Utils设置,以及activity_main.xml、activity_rejist.xml和activity_shou_ye.xml等布局文件的使用。
摘要由CSDN通过智能技术生成


依赖

compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.bigkoo:convenientbanner:2.0.5'
compile 'org.xutils:xutils:3.5.0'
compile 'com.google.code.gson:gson:2.8.2'

项目清单文件(初始化Utils)

<application
    android:name=".MyApplication"

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.asus.login4.MainActivity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="32dp"
        android:gravity="center"
        android:textSize="18dp"
        android:text="登录"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="vertical"
        android:id="@+id/shuru">

        <EditText
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:id="@+id/login_phone"
            android:hint="请输入手机号"
            android:layout_gravity="center"
            android:gravity="center"
            android:layout_marginTop="15dp" />

        <EditText
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:id="@+id/login_pwd"
            android:gravity="center"
            android:layout_gravity="center"
            android:hint="请输入密码"
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值