首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android可绘制项目动画- React Native

Android可绘制项目动画- React Native
EN

Stack Overflow用户
提问于 2018-11-13 07:31:02
回答 1查看 303关注 0票数 0

我在我的应用程序中制作android闪屏,我使用React Native,但在android可绘制组件中制作闪屏。我不熟悉android,我想让我的图像在闪屏上上下弹跳。但是我不知道该怎么做。这是我的闪屏:

代码语言:javascript
复制
<?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;

代码语言:javascript
复制
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();
    }
}

谢谢所有能帮上忙的人。

EN

回答 1

Stack Overflow用户

发布于 2018-11-13 14:20:37

首先,您必须创建一个活动。SplashScreen将出现的位置。然后,您必须为反弹动画创建一个XML文件。像这样,bounce.xml

代码语言:javascript
复制
<?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

代码语言:javascript
复制
Animation an2=AnimationUtils.loadAnimation(this,R.anim.bounce);
your_logo.startAnimation(an2);

完成动画后,转到主活动。并完成当前的SplashScreen活动,如下所示。

代码语言:javascript
复制
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53271620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档