设为首页 加入收藏

TOP

安卓开发学习笔记(七):仿写腾讯QQ登录注册界面(一)
2019-09-01 23:26:51 】 浏览:79
Tags:安卓 开发 学习 笔记 腾讯 登录 注册 界面

这段代码的关键主要是在我们的相对布局以及线性布局上面,我们首先在总体布局里设置为线性布局,然后再在里面设置为相对布局,这是一个十分常见的XML布局模式。

废话不多说,直接上代码:
一.activity.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:orientation="vertical" android:background="@drawable/bg2"
    >

    <!--头部内容-->
    <RelativeLayout android:layout_width="match_parent" android:layout_height="160dp" android:padding="16dp" android:layout_margin="0dp"
        >



    </RelativeLayout>

    <!--输入框-->
    <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:layout_margin="0dp"
        >

        <EditText android:id="@+id/account" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:hint="QQ号/密码/邮箱"/>
        />
        <EditText android:layout_below="@id/account" android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:password="true" android:hint="密码"/>
        />

    </RelativeLayout>

    <RelativeLayout android:layout_width="match_parent" android:layout_height="33dp" android:padding="0dp" android:layout_margin="0dp"
        >
        <CheckBox android:id="@+id/remember_pass" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="记住密码"/>


    </RelativeLayout>

    <!--密码功能-->
    <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp">

        <Button android:id="@+id/login" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="登录" android:textColor="#fff" android:background="#008cc9"/>

        <Button android:id="@+id/forget_pwd" android:layout_below="@id/login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:textColor="#2999ce" android:gravity="start" android:layout_marginTop="16dp" android:textSize="16dp" android:text="忘记密码?"/>

        <Button android:id="@+id/register" android:layout_below="@id/login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:textColor="#2999ce" android:gravity="end" android:text="新用户注册" android:layout_marginTop="16dp" android:textSize="16dp" android:layout_al
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Error occurred during initializ.. 下一篇学习安卓开发[3] - 使用RecyclerV..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目