Android即时通讯--仿QQ即时聊天:(二)闪屏页及登录页面的实现

1、闪屏页

在每一个Android应用程序中一般都会有一个闪屏页,用来完成展示产品LOGO、检查版本更新、打广告等操作。在这个项目中,只是简单的展示一下产品的LOGO。效果图如下

   

闪屏页的代码

public class SplashActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		/**
		 * 在子线程中做一些操作,之后跳转到登录界面
		 */
		ThreadUtils.runInSubThread(new Runnable() {

			public void run() {
				try {
					Thread.sleep(3000);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				startActivity(new Intent(getApplicationContext(),
						LoginActivity.class));

			}
		});

	}

}

2、登录页面


登录页面的效果图如下

   

布局文件如下

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#D4D0C8"
    tools:context="com.itcast.im.wh9.MainActivity2" >

    <TableLayout
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" >

        <!-- 图标 -->

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_launcher" />

        <!-- 账号输入 -->

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="账号"
                android:textSize="22sp" />

            <EditText
                android:text="101"
                android:id="@+id/account"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:singleLine="true" />
        </TableRow>
        <!-- 密码输入 -->

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="密码"
                android:textSize="22sp" />

            <EditText
                android:id="@+id/password"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:inputType="textPassword"
                android:singleLine="true"
                android:text="test" />
        </TableRow>
        <!-- 登录 -->

        <Button
            android:id="@+id/login"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp"
            android:gravity="center"
            android:text="登录"
            android:textSize="22sp" />
    </TableLayout>

</RelativeLayout>
先从布局开始,避免直接上逻辑报错影响心情,哈哈^_^,相信但凡有一点Android功底的童鞋对这些布局根本不屑一顾,下一篇开始实现登录的逻辑,不要错过哦!!!


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值