首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

程序启动时欢迎画面不显示,

2013-11-21 
程序启动时欢迎画面不显示,求助~这是我的欢迎界面ACTIVITY,持续5秒public class LoginActivity extends Ac

程序启动时欢迎画面不显示,求助~
这是我的欢迎界面ACTIVITY,持续5秒
public class LoginActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

/** 标题是属于View的,所以窗口所有的修饰部分被隐藏后标题依然有效 */
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.login);
mHandler.sendEmptyMessageAtTime(GOTO_MAIN_ACTIVITY, 5000);// 3秒跳转
}

private static final int GOTO_MAIN_ACTIVITY = 0;
private Handler mHandler = new Handler() {

public void handleMessage(Message msg) {

switch (msg.what) {
case GOTO_MAIN_ACTIVITY:
Intent intent = new Intent();
intent.setClass(getApplicationContext(), MainActivity.class);
startActivity(intent);
finish();
break;

default:
break;
}

}

};

}

这是我的欢迎界面的XML文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/iv"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_launcher" />

</LinearLayout>

[解决办法]
使用sendEmptyMessageDelay方法,给分吧。哈哈

热点排行