实现一个简易仿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&#