每日学习
今天准备开始做团队作业。
首先做的是进入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" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@mipmap/first" /> </RelativeLayout>
java代码:
package com.example.bowenwang; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.view.View; import android.view.WindowManager; import java.util.Timer; import java.util.TimerTask; public class firstActivity extends AppCompatActivity { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_first); this. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Timer timer = new Timer(); TimerTask task = new TimerTask() { @Override public void run() { Intent intent = new Intent(firstActivity.this, MainActivity.class); startActivity(intent); firstActivity.this.finish(); } }; getWindow().setStatusBarColor(Color.TRANSPARENT); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); timer.schedule(task, 3000); } }