Android实现简单QQ登录页面

 更新时间:2022年04月24日 14:45:05   作者:Lssの老父亲  
这篇文章主要为大家详细介绍了Android实现简单QQ登录页面,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

Android开发实现极为简单的QQ登录页面,供大家参考,具体内容如下

设计一个简单QQ登录页面,无任何功能。然后打包安装到手机。

1.首先创建一个空白页面

2.打开样式设计的页面

在activity_main.xml中写入代码

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:background="#E6E6E6"//改背景色
    tools:context=".MainActivity">
    <RelativeLayout android:layout_width="match_parent"//相对布局
        android:layout_height="match_parent"
        android:layout_marginTop="60dp"//距顶部距离
        android:background="#E6E6E6"//改背景色
        android:orientation="vertical">

    <ImageView//放图片
        android:id="@+id/iv"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_centerHorizontal="true"//居中
        android:layout_marginTop="40dp"
        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"//在imageview下面
        android:layout_centerVertical="true"//居中
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="15dp"
        android:background="#ffffff">
        <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="#ffffff">
        <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_marginRight="10dp"
        android:layout_marginTop="50dp"
        android:background="#3C8DC4"
        android:text="登录"
        android:textColor="#ffffff"
        android:textSize="20sp"/>
    </RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

在虚拟机里跑一下

效果还算可以吧
试试能不能打包一下,安装到手机上。

报错了…

网上查了一下解决办法。在build.gradle文件里添点代码:

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

成功了。

挺不错

参考图书《Android移动开发基础案例教程》

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

相关文章

  • Android多线程断点续传下载实现代码

    Android多线程断点续传下载实现代码

    这篇文章主要介绍了Android多线程断点续传下载实现代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-11-11
  • 修改Android Studio 的 Logcat 缓冲区大小操作

    修改Android Studio 的 Logcat 缓冲区大小操作

    这篇文章主要介绍了修改Android Studio 的 Logcat 缓冲区大小操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-04-04
  • Flutter中数据库的使用教程详解

    Flutter中数据库的使用教程详解

    在Flutter开发过程中,有时需要对数据进行本地的持久化存储,使用sp文件形式虽然也能解决问题,但是有时数据量较大的时候,显然我们文件形式就不太合适了,这时候我们就需要使用数据库进行存储。本文将详细讲讲Flutter中数据库的使用,需要的可以参考一下
    2022-04-04
  • Android头像上传功能的实现代码(获取头像加剪切)

    Android头像上传功能的实现代码(获取头像加剪切)

    最近在做一个头像上传的项目,下面小编给大家分享Android头像上传功能的实现代码,需要的的朋友参考下吧
    2017-08-08
  • Android性能优化方案详情

    Android性能优化方案详情

    这篇文章主要给大家分享的是Android项目工程内的一些性能优化方式,文章围绕Android项目工程优化方式展开内容,需要的朋友可以参考一下文章的具体详情,希望对你有所帮助
    2021-11-11
  • Android如何调整线程调用栈大小

    Android如何调整线程调用栈大小

    这篇文章主要介绍了Android如何调整线程调用栈大小,帮助大家更好的进行Android开发,完善自身程序,感兴趣的朋友可以了解下
    2020-10-10
  • Android Spinner与适配器模式详解及实例代码

    Android Spinner与适配器模式详解及实例代码

    这篇文章主要介绍了Android Spinner与适配器模式详解相关资料,并附代码实例,需要的朋友可以参考下
    2016-10-10
  • Android Studio开发中Gradle各种常见报错问题解决方案

    Android Studio开发中Gradle各种常见报错问题解决方案

    这篇文章主要为大家介绍了Android Studio开发中Gradle各种常见报错问题解决方案,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2023-12-12
  • Android中碎片的使用方法详解

    Android中碎片的使用方法详解

    这篇文章主要介绍了Android中碎片的使用方法详解,其实碎片很简单,但是网上胡乱充数的博文太多了,以至于我们有时候觉得比较乱,今天就来简单讲解一下碎片的使用,需要的朋友可以参考下
    2019-06-06
  • android九宫格可分页加载控件使用详解

    android九宫格可分页加载控件使用详解

    这篇文章主要介绍了android九宫格可分页加载控件的使用方法,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-02-02

最新评论