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

来源:互联网 发布:迪卡侬14.9背包知乎 编辑:程序博客网 时间:2024/05/22 13:21

1、闪屏页

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

   

闪屏页的代码

public class SplashActivity extends Activity {@Overrideprotected 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 blocke.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功底的童鞋对这些布局根本不屑一顾,下一篇开始实现登录的逻辑,不要错过哦!!!


0 0
原创粉丝点击