Android的文本视图过渡 [英] Android text view transition
本文介绍了Android的文本视图过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新android开发。我想创建两个文本视图的启动画面。在这个启动画面我想两个转变
I am new to android development. I want to create a splash screen with two text views. In this splash screen I want two transitions
1)文本视图1从上过渡到中心
2)文本视图2从底部到中间过渡
1) Text View 1 transition from top to center 2) text View 2 transition from bottom to center
两个过渡应在同一时间进行
Both transitions should be performed at the same time
如何实现这一目标?
谢谢,
推荐答案
科瑞一个 XML
文件code>
Creat an xml
file in your anim folder name bottom_to_top.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="2000"
android:fillAfter="true"
android:fromYDelta="100%p"
android:toYDelta="0%p" />
</set>
和您的oncreat添加此
and your oncreat you add this
TextView textview= (TextView) findViewById(R.id.textview);
Animation bottomToTop = AnimationUtils.loadAnimation(this, R.anim.bottom_to_top);
textview.startAnimation(bottomToTop);
并从顶部到底部动画
创建一个 XML
按名称文件 top_bottom.xml
在你的动画文件夹
create an xml
file by name top_bottom.xml
in your anim folder
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="2000"
android:fillAfter="true"
android:fromYDelta="-100%p"
android:toYDelta="0%p" />
</set>
和java中的地方
TextView textview2= (TextView) findViewById(R.id.textview2);
Animation topTobottom = AnimationUtils.loadAnimation(this, R.anim.top_bottom);
textview2.startAnimation(topTobottom );
希望这有助于你
这篇关于Android的文本视图过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文