我在我的应用程序中制作android闪屏,我使用React Native,但在android可绘制组件中制作闪屏。我不熟悉android,我想让我的图像在闪屏上上下弹跳。但是我不知道该怎么做。这是我的闪屏:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/white" />
<item
android:width="180dp"
android:height="90dp"
android:drawable="@mipmap/icon"
android:gravity="center" />
</layer-list>这是我的包: package com.nasapecenjara;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}谢谢所有能帮上忙的人。
发布于 2018-11-13 14:20:37
首先,您必须创建一个活动。SplashScreen将出现的位置。然后,您必须为反弹动画创建一个XML文件。像这样,bounce.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/bounce_interpolator">
<scale
android:duration="2000"
android:fromXScale="1.0"
android:fromYScale="0.0"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>然后在SplashScreen活动中使用上面的xml
Animation an2=AnimationUtils.loadAnimation(this,R.anim.bounce);
your_logo.startAnimation(an2);完成动画后,转到主活动。并完成当前的SplashScreen活动,如下所示。
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();https://stackoverflow.com/questions/53271620
复制相似问题