这篇文章主要为大家详细介绍了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实现简单QQ登录页面
基础教程推荐
猜你喜欢
- iOS开发教程之XLForm的基本使用方法 2023-05-01
- Flutter手势密码的实现示例(附demo) 2023-04-11
- Flutter绘图组件之CustomPaint使用详解 2023-05-12
- Android中的webview监听每次URL变化实例 2023-01-23
- Android开发使用RecyclerView添加点击事件实例详解 2023-06-15
- IOS应用内跳转系统设置相关界面的方法 2022-11-20
- IOS 播放系统提示音使用总结(AudioToolbox) 2023-03-01
- 解决Android Studio突然不显示logcat日志的问题 2023-02-04
- android studio按钮监听的5种方法实例详解 2023-01-12
- Android多返回栈技术 2023-04-15
