一.:第一步页面停留3秒自己跳转下一个页面
1:代码布局
activity_second.xml
<LinearLayout 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="@drawable/ic_launcher"
tools:context=".SecondActivity" >
</LinearLayout>
2:第一个页面用Java 实现3秒跳转
package com.example.day06;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.WindowManager;
public class SecondActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 1:隐藏状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// 2:隐藏标题栏
getActionBar().hide();
setContentView(R.layout.activity_second);
// 1:定义一个子线程
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// 休眠3秒
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 2;开启新的activity页面
Intent it = new Intent(getApplicationContext(),
MainActivity.class);
startActivity(it);
}
});
// 2:启动这个子线程
t.start();
}
}
(通过以上代码实现以上这个页面并且停留3秒然后跳转到下一个页面)
二:实现第二个页面的代码布局
1:代码布局
activity_main.xml
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#394144"
android:gravity="center"
android:text="用户注册"
android:textColor="#fff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp" >
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical|right"
android:text="账号:" />
<EditText
android:id="@+id/et1"
android:layout_width="0dp"
android:layout_height="match_parent"