Android 简易QQ登录页面

编程知识 更新时间:2023-05-01 22:44:03

<?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登录页面

本文发布于:2023-04-24 08:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/d89b24ef33ae98e6ee6f58e116488001.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简易   页面   Android   QQ

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 100090文章数
  • 26007阅读数
  • 0评论数