欢迎界面的操作创建两个Activity:MainActivity和ActivityDemo
代码如下:
package com.example.helloword;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Handler x = new Handler() ;
x.postDelayed(new splashhandler(), 3000) ;
}
class splashhandler implements Runnable{
@Override
public void run() {
startActivity(new Intent(MainActivity.this,Activitydemo.class)) ;
MainActivity.this.finish() ;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
main.xml代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/welcome_logo"
android:scaleType="fitCenter"
android:id="@+id/wordpress_logo"/>
</LinearLayout>