Android页面实现三个页面跳转Activity——>Intent

一.:第一步页面停留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_pare...
摘要由CSDN通过智能技术生成
  一.:第一步页面停留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"
   
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值