利用 Android studio 2021 软件输出一个简易用户登录界面,拥有头像并且能够实现对自行输入的账号密码进行保存,文件名为 saveqq,功能实现对账号与密码的输入和存储,简单QQ界面布局。
前言
本文将直接介绍如何实现对于 QQ 登录时保存账号与密码的功能,这是主要目的。基于本人编写运行后的代码,保持精简,让读者有个好的观看和操作体验。配置:Android studio 2021.1.1.21 windows
最后实现效果:
一、具体步骤
1.创建程序
打开 Android studio,在 Android studio 创建一个新的应用程序,命名为SaveQQ。
2.实现界面布局
在界面左侧 layout 包下的 acyivity_main.xml 下编写界面布局。
界面布局代码如下(示例):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E6E6E6"
android:orientation="vertical"
android:padding="10dp">
<ImageView
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:src="@drawable/handsome" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"