<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E6E6E6"
android:orientation="vertical">
<ImageView
android:id="@+id/iv"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:background="@drawable/head" />
<LinearLayout
android:id="@+id/ll_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:background="#fff">
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="账号:"
android:textColor="#000"
android:textSize="20sp" />
<EditText
android:id="@+id/et_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@null"
android:padding="10dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_number"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#fff"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="密码:"
android:textColor="#000"
android:textSize="20sp" />
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/tv_password"
android:background="@null"
android:inputType="textPassword"
android:padding="10dp" />
</LinearLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ll_password"
android:layout_marginLeft="10dp"
android:layout_marginTop="50dp"
android:layout_marginRight="10dp"
android:background="#3C8DC4"
android:text="登录"
android:textColor="#fff"
android:textSize="20sp" />
</RelativeLayout>
前情提要1 :静态页面-简易QQ登录页面
(纯activity_main.xml页面)【https://blog.csdn/weixin_44949135/article/details/104504728】
前情提要2 :动态页面-简单保存QQ密码
(数据存储:文件存储、SharedPreferences)【https://blog.csdn/weixin_44949135/article/details/104965413】
验证QQ密码 ,在前情提要2的基础上,实现了如下功能:
【https://blog.csdn/weixin_44949135/article/details/106001065】
如果账号存在,且密码正确,在app页面上,显示 “ 账号存在!密码正确!登陆成功!” 的 文本提示;
如果账号存在,但密码不正确,在app页面上,显示 “ 账号存在!密码错误!登陆失败!” 的 文本提示;
如果账号不存在,且密码不为空,则注册账号(保存用户名与密码)。
局限性 :只能 存储 一个 账号的信息(账号、密码)。
如果在 “ 账号不存在 and 密码不为空 ” 的情况下,点击 “ 登录 ” 按钮,
将自动注册账号,保存账号信息(账号、密码),原账号信息 将被 新账号信息 替代。
转发请附上原文链接。点个赞再走啊~
更多推荐
Android 简易QQ登录页面
发布评论