Android 文本视图转换
Android text view transition
我是 android 开发的新手。我想创建一个带有两个文本视图的启动画面。在此初始屏幕中,我想要两个转换
1) 文本视图 1 从顶部到中心的过渡
2) 文本视图 2 从底部到中心的过渡
两个转换应同时执行
如何实现?
谢谢,
在您的动画文件夹名称中创建一个 xml
文件 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你添加这个
TextView textview= (TextView) findViewById(R.id.textview);
Animation bottomToTop = AnimationUtils.loadAnimation(this, R.anim.bottom_to_top);
textview.startAnimation(bottomToTop);
以及从上到下动画
在您的 anim 文件夹中创建一个 xml
名称为 top_bottom.xml
的文件
<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 开发的新手。我想创建一个带有两个文本视图的启动画面。在此初始屏幕中,我想要两个转换
1) 文本视图 1 从顶部到中心的过渡 2) 文本视图 2 从底部到中心的过渡
两个转换应同时执行
如何实现?
谢谢,
在您的动画文件夹名称中创建一个 xml
文件 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你添加这个
TextView textview= (TextView) findViewById(R.id.textview);
Animation bottomToTop = AnimationUtils.loadAnimation(this, R.anim.bottom_to_top);
textview.startAnimation(bottomToTop);
以及从上到下动画
在您的 anim 文件夹中创建一个 xml
名称为 top_bottom.xml
的文件
<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 );
希望对您有所帮助