App启动页面

一、启动页面布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff">

    <ImageView
        android:id="@+id/atguigu_logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/atguigu_logo"
        android:layout_centerHorizontal="true"
        android:layout_centerInParent="true"/>

</RelativeLayout>

二、启动页面代码

public class WelcomeActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
new Handler().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(WelcomeActivity.this, MainActivity.class)); finish(); } }, 2000); } }

猜你喜欢

转载自www.cnblogs.com/mxsf/p/10585021.html
今日推荐