android 开发 启动界面出现问题 图片加载不了
//mainactivity.javapackage com.example.b526;
import android.os.Bundle;
import android.app.Activity;
import android.os.Handler;
import android.os.Message;
import android.widget.ViewFlipper;
public class MainActivity extends Activity {
public class SplashScreen extends Activity {
private ViewFlipper allFlipper;
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
switch (msg.what) {
case 1:
//切换到主页面
allFlipper.setDisplayedChild(1);
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
allFlipper = (ViewFlipper) findViewById(R.id.relativeLayout1);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
handler.sendEmptyMessage(1); //给UI主线程发送消息
}
}, 3000); //启动等待3秒钟
}
}
}
//splashscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/splashlayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="206dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
</ViewFlipper>