安卓好看的登录界面

简介: 安卓好看的登录界面

昨天简单写了下记住密码和显示密码,由于时间有限随便写了一下,今天有时间,给大家详细的写一下比较好看的登录界面。

5b18fb237aa616a387940d32e866464.png

跟往常一样,废话不多少,先上一张效果图吧

接下来先教大家弄一下这个渐变布局,喜欢别的颜色可以更改,在drawable里新建一个文件,代码如下:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:startColor="#009393"
        android:endColor="#bbffbb"
        android:angle="90"/>
</shape>


然后开始写布局,布局就是一个简单的用线性布局包裹着的一个布局,直接粘上代码让大家看看吧:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:background="@drawable/sha"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="账号登录"
        android:layout_gravity="center"
        android:layout_marginTop="85dp"
        android:textColor="#ffffff"
        android:textSize="30sp"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:orientation="horizontal"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:layout_marginTop="15dp"
        android:background="#ffffff">
        <EditText
            android:id="@+id/ed_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:hint="请输入账号"
            android:textColorHint="#f0f0f0"
            android:background="@null"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:orientation="horizontal"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:layout_marginTop="15dp"
        android:background="#ffffff">
        <EditText
            android:id="@+id/ed_pass"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:hint="请输入密码"
            android:inputType="textPassword"
            android:textColorHint="#f3f3f3"
            android:background="@null"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:orientation="horizontal"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:layout_marginTop="15dp">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <CheckBox
                android:id="@+id/ck_pass"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="记住密码"
                android:gravity="center"
                android:textColor="#ffffff"/>
            <CheckBox
                android:id="@+id/ck_xian"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:text="显示密码"
                android:gravity="center"
                android:textColor="#ffffff"/>
            <TextView
                android:id="@+id/tv_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#ffffff"
                android:gravity="center"
                android:layout_marginTop="8dp"
                android:layout_alignParentRight="true"
                android:text="注册账号"/>
        </RelativeLayout>
    </LinearLayout>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="65dp"
        android:layout_marginRight="65dp"
        android:layout_marginTop="15dp"
        android:background="#009393"
        android:text="登录"
        android:onClick="log"
        android:textColor="#ffffff"
        android:textSize="20sp"/>
</LinearLayout>

好了,写到这里你就可以运行一下自己的应用,就会发现你也有这样的登录界面,注明一点:最外层的线性布局的背景就是最开始咱们写的那个文件,引用一下就好了,欢迎大家在这里相互交流。


 


目录
相关文章
|
5月前
|
数据安全/隐私保护 Android开发
2023安卓逆向 -- 某合伙apk登录加密分析
2023安卓逆向 -- 某合伙apk登录加密分析
58 0
|
12月前
|
JavaScript Java Android开发
Cocos Creator Android 平台 Facebook 原生登录(二)
Cocos Creator Android 平台 Facebook 原生登录
199 0
|
12月前
|
开发工具 Android开发 数据安全/隐私保护
Cocos Creator Android 平台 Facebook 原生登录(一)
Cocos Creator Android 平台 Facebook 原生登录
482 0
|
12月前
|
API 开发工具 Android开发
解决 Android App 上架 Google play后 ,签名变更,第三方sdk无法登录
解决 Android App 上架 Google play后 ,签名变更,第三方sdk无法登录
267 0
|
2月前
|
开发工具 Android开发
|
2月前
|
安全 Java 网络安全
Android远程连接和登录FTPS服务代码(commons.net库)
很多文章都介绍了FTPClient如何连接ftp服务器,但却很少有人说如何连接一台开了SSL认证的ftp服务器,现在代码来了。
75 2
|
4月前
|
数据库 Android开发 数据安全/隐私保护
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
178 2
|
4月前
|
XML Android开发 数据格式
【Android UI】使用RelativeLayout与TableLayout实现登录界面
【Android UI】使用RelativeLayout与TableLayout实现登录界面
48 5
|
4月前
|
存储 数据库 Android开发
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
109 0
|
5月前
|
XML Android开发 数据格式
Android注册登录页面2
Android注册登录页面
51 2
下一篇
无影云桌面