[安卓初学者实验]实现一个简单仿qq登陆界面

本文档指导安卓初学者实现一个简单的QQ登录界面,包括账号密码输入、登录验证、登录成功后进入主界面展示登录信息,以及主界面的头像选择功能。在主界面中,有当前登录账号显示、退出按钮和包含不同联系人类型的ListView。登录验证使用预设的账号密码数组,头像选择通过GridView实现。
摘要由CSDN通过智能技术生成

实现一个简易仿qq登录界面,要求实现:

1)     登录界面有帐号、密码文本和编辑框,登录和退出按钮。在程序中维护一个帐号密码的数组,用以判断正确登录与否。如果登录成功,则进入qq主界面,否则清空帐号和密码编辑框,重新登录;

2)     在qq主界面中,显示当前登录帐号信息、退出登录按钮和一个列表框listview,列表框中有以下几项:在线好友、我的好友、陌生人、黑名单和我的群;

3)     在qq主界面中,可以给当前登录帐号选择头像。当点击登录帐号头像时,进入头像选择界面,该界面是一个gridview(其用法参考P133例子),每个格子中放一个头像,选中确定后返回qq主界面,并在qq主界面显示所选中的头像。


效果图:登陆界面


布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#fff0f0f0" >
 
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingBottom="10.0dip" >
 
                <ImageView
                    android:layout_width="57.0dip"
                    android:layout_height="57.0dip"
                    android:layout_gravity="center"
                    android:src="@drawable/ic_launcher"
                    android:adjustViewBounds="true"
                    android:contentDescription="@null"
                    android:scaleType="centerCrop"
                    />
 
            <EditText
                android:id="@+id/userNameText"
                android:layout_width="fill_parent"
                android:layout_height="50.0dip"
                android:layout_marginLeft="12.0dip"
                android:layout_marginRight="12.0dip"
                android:layout_marginTop="15.0dip"
                android:background="#FFFFFF"
                android:ems="10"
                android:hint="@string/login_user"
                android:inputType="number"
                android:paddingBottom="2.0dip"
                android:paddingLeft="15.0dip"
                android:paddingRight="15.0dip"
                android:paddingTop="2.0dip"
                android:singleLine="true"
                android:textColorHint="#ff999999"
                android:textSize="16.0sp" />
 
            <EditText
                android:id="@+id/passwdText"
                android:layout_width="fill_parent"
                android:layout_height="50.0dip"
                android:layout_marginBottom="20.0dip"
                android:layout_marginLeft="12.0dip"
                android:layout_marginRight="12.0dip"
                android:layout_marginTop="20.0dip"
                android:background="#ffffff"
                android:drawablePadding="15.0dip"
                android:ems="10"
                android:hint="@string/login_password"
                android:inputType="textPassword"
                android:paddingBottom&#
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值