Android Material 启动画面动画,如 Palabre 应用程序
Android Material Animation with Splash Screen like Palabre Application
这是 Palabre
视图的启动画面:
https://play.google.com/store/apps/details?id=com.levelup.palabre
正如我们所见,在应用程序启动时,有一个带有图像动画的启动画面。
这就是我正在努力实现的美丽 :) :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/grand_canyon"/>
</RelativeLayout>
结果:
并且这个 SplashActivity 有全屏 view.So,
我们如何才能像 Palabre
一样向左或向右移动此图像?
这个屏幕上的图像大小是多少?
编辑:
我还为全屏图像视图找到了这个:
在您的布局中:
android:scaleType = "centerCrop"
我们需要向这个图像视图添加什么动画?
谢谢
我认为混合使用 Scale 和 TranslateAnimation 可以达到目的。
另一种选择是使用动画集 (http://developer.android.com/reference/android/animation/AnimatorSet.html)
编辑:这里有一些带有多个动画的 ObjectAnimator 示例,其中 myView 是您要设置动画的视图。检查此 link 以了解动画属性(rotationX、rotationY 等)http://developer.android.com/guide/topics/graphics/prop-animation.html#views
AnimatorSet animSet = new AnimatorSet();
animSet.playTogether(
ObjectAnimator.ofFloat(myView, "rotationX", 0, 360),
ObjectAnimator.ofFloat(myView, "rotationY", 0, 180),
ObjectAnimator.ofFloat(myView, "rotation", 0, -90),
ObjectAnimator.ofFloat(myView, "translationX", 0, 90),
ObjectAnimator.ofFloat(myView, "translationY", 0, 90),
ObjectAnimator.ofFloat(myView, "scaleX", 1, 1.5f),
ObjectAnimator.ofFloat(myView, "scaleY", 1, 0.5f),
ObjectAnimator.ofFloat(myView, "alpha", 1, 0.25f, 1)
);
animSet.setDuration(5000).start();
还要检查我是否指定了以毫秒为单位的动画持续时间。
如果您的目标是 API 11 岁以下,请选中 http://nineoldandroids.com/ 以在较旧的机器人上使用 AnimatorSet。
希望对您有所帮助。
我发现它 finally.It 很漂亮 :)
只需添加依赖项:
compile 'com.flaviofaria:kenburnsview:1.0.6'
并且,
XML布局:
<com.flaviofaria.kenburnsview.KenBurnsView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/img"
android:scaleType = "centerCrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash" />
Github: https://github.com/flavioarfaria/KenBurnsView
感谢 Flávio Faria 提供这个优秀的图书馆。
但是,它有一个问题,就是当图像转到另一边时,它就像一个错误或卡住之类的东西,我还没有找到最好的解决方案。
这是我认为你应该做的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_splash" >
</RelativeLayout>
这是 Palabre
视图的启动画面:
https://play.google.com/store/apps/details?id=com.levelup.palabre
正如我们所见,在应用程序启动时,有一个带有图像动画的启动画面。
这就是我正在努力实现的美丽 :) :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/grand_canyon"/>
</RelativeLayout>
结果:
并且这个 SplashActivity 有全屏 view.So,
我们如何才能像 Palabre
一样向左或向右移动此图像?
这个屏幕上的图像大小是多少?
编辑:
我还为全屏图像视图找到了这个: 在您的布局中:
android:scaleType = "centerCrop"
我们需要向这个图像视图添加什么动画?
谢谢
我认为混合使用 Scale 和 TranslateAnimation 可以达到目的。
另一种选择是使用动画集 (http://developer.android.com/reference/android/animation/AnimatorSet.html)
编辑:这里有一些带有多个动画的 ObjectAnimator 示例,其中 myView 是您要设置动画的视图。检查此 link 以了解动画属性(rotationX、rotationY 等)http://developer.android.com/guide/topics/graphics/prop-animation.html#views
AnimatorSet animSet = new AnimatorSet();
animSet.playTogether(
ObjectAnimator.ofFloat(myView, "rotationX", 0, 360),
ObjectAnimator.ofFloat(myView, "rotationY", 0, 180),
ObjectAnimator.ofFloat(myView, "rotation", 0, -90),
ObjectAnimator.ofFloat(myView, "translationX", 0, 90),
ObjectAnimator.ofFloat(myView, "translationY", 0, 90),
ObjectAnimator.ofFloat(myView, "scaleX", 1, 1.5f),
ObjectAnimator.ofFloat(myView, "scaleY", 1, 0.5f),
ObjectAnimator.ofFloat(myView, "alpha", 1, 0.25f, 1)
);
animSet.setDuration(5000).start();
还要检查我是否指定了以毫秒为单位的动画持续时间。
如果您的目标是 API 11 岁以下,请选中 http://nineoldandroids.com/ 以在较旧的机器人上使用 AnimatorSet。
希望对您有所帮助。
我发现它 finally.It 很漂亮 :) 只需添加依赖项:
compile 'com.flaviofaria:kenburnsview:1.0.6'
并且,
XML布局:
<com.flaviofaria.kenburnsview.KenBurnsView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/img"
android:scaleType = "centerCrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash" />
Github: https://github.com/flavioarfaria/KenBurnsView
感谢 Flávio Faria 提供这个优秀的图书馆。
但是,它有一个问题,就是当图像转到另一边时,它就像一个错误或卡住之类的东西,我还没有找到最好的解决方案。
这是我认为你应该做的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_splash" >
</RelativeLayout>