Android中自动跳转
先看效果图吧
--------> -------->
Activity类
1 package com.xm; 2 3 import java.io.File; 4 import java.util.ArrayList; 5 import java.util.Collections; 6 import java.util.HashMap; 7 import java.util.List; 8 import java.util.Map; 9 10 import android.app.Activity; 11 import android.content.Intent; 12 import android.content.IntentFilter; 13 import android.media.MediaPlayer; 14 import android.media.MediaPlayer.OnCompletionListener; 15 import android.os.Bundle; 16 import android.os.Environment; 17 import android.os.Handler; 18 import android.view.View; 19 import android.view.View.OnClickListener; 20 import android.widget.AdapterView; 21 import android.widget.Button; 22 import android.widget.ImageButton; 23 import android.widget.ListView; 24 import android.widget.SeekBar; 25 import android.widget.SimpleAdapter; 26 import android.widget.Spinner; 27 import android.widget.TextView; 28 import android.widget.AdapterView.OnItemClickListener; 29 import android.widget.AdapterView.OnItemSelectedListener; 30 import android.widget.SeekBar.OnSeekBarChangeListener; 31 /** 32 * 页面跳转页面 33 * @author Administrator 34 * 35 */ 36 public class Music_ym extends Activity { 37 private final long SPLASH_LENGTH = 2000; 38 Handler handler = new Handler(); 39 @Override 40 protected void onCreate(Bundle savedInstanceState) { 41 super.onCreate(savedInstanceState); 42 setContentView(R.layout.mainym); 43 handler.postDelayed(new Runnable() { 44 @Override 45 public void run() { 46 Intent intent = new Intent(Music_ym.this,Music.class); 47 startActivity(intent); 48 finish(); 49 } 50 }, SPLASH_LENGTH); 51 } 52 }
xml配置文件
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_parent" 5 android:layout_height="fill_parent" 6 > 7 <ImageView 8 android:layout_width="wrap_content" 9 android:layout_height="fill_parent" 10 android:src="@drawable/abc" 11 /> 12 </LinearLayout>