用androidStudio设计一个登录页面,并且能记住账号和密码的功能!
目前大多数市场的APP都会存在一个登录界面设计,一个好的登录界面如果功能强大,是很吸引用户的,也极大的给用户带来舒适的体验,那么一个好的登录界面除了界面的美观、还应该具有操作简单、能够记住密码等,本次博客,我们将会给大家讲解如何让登录界面记住密码!
(一)、登录界面的设计
这里学长采用的登录界面的设计是在线性布局的基础上结合框架布局形成的一个现代化风格的界面,首先我们来看下设计的效果图!

可以看到,以上具有的功能包括记住密码、自动登录、忘记密码的处理方法、以及注册账号,但学长目前完成的只有记住密码模块,其他的以后再慢慢进行讲解!
1、界面设计的xml代码如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:background="@drawable/back6"
android:id="@+id/back3"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="235dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/back"
android:src="@drawable/pto4" />
<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:id="@+id/pto"
android:layout_marginTop="70dp"
android:layout_marginLeft="5dp"
android:src="@drawable/pto"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/userName"
android:layout_marginTop="70dp"
android:hint="@string/user"
android:layout_marginLeft="5dp"
android:inputType="text"
android:layout_toRightOf="@id/pto"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/password"

本文介绍如何在Android Studio中设计登录页面,并实现记住账号密码功能。利用XML布局实现界面美化,通过SharedPreferences存储账号密码,提升用户体验。
最低0.47元/天 解锁文章
5011

被折叠的 条评论
为什么被折叠?



