2016-02-29 43 views
1

我是新android開發。我想創建一個包含兩個文本視圖的啓動畫面。在這個啓動畫面我想兩個轉變Android的文本視圖過渡

1)文本視圖1從頂部過渡到中心 2)文本顯示2個底部過渡到中心

兩個轉變應在同一時間

進行如何實現這一目標?

感謝,

回答

0

科瑞一個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); 

和從上到下的動畫

在你的動畫文件夾

<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中創建一個xml文件的名字top_bottom.xml

  TextView textview2= (TextView) findViewById(R.id.textview2); 
      Animation topTobottom = AnimationUtils.loadAnimation(this, R.anim.top_bottom); 
      textview2.startAnimation(topTobottom); 

希望這有助於你

+0

讓我知道結果 – saeed