android - Animation a layout from bottom to top with fade in -


i want animation first fadein textview id symbol_no bottom top fadein other view on screen.

symbolnotextview.animate().setduration(duration).     scalex(1).scaley(1).     translationx(0).translationy(0).     setinterpolator(sdecelerator).     withendaction(new runnable() {         public void run() {             // animate description in after image animation             // done. slide , fade text in underneath             // picture.             mtextview.settranslationy(-mtextview.getheight());             mtextview.animate().setduration(duration/2).             translationy(0).alpha(1).             setinterpolator(sdecelerator);         }     }); 

but think not mean .

here xml of design

  <linearlayout        xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="match_parent"     android:weightsum="100"     android:id="@+id/toplevel">  <linearlayout     android:layout_width="fill_parent"     android:layout_height="0dp"     android:orientation="horizontal"     android:layout_weight="15"     android:background="@drawable/borderframe">     <imagebutton         android:layout_width="wrap_content"         android:layout_height="fill_parent"         android:padding="5dp"         android:src="@drawable/abc_btn_radio_to_on_mtrl_015"         />     <textview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:text="21477"         android:padding="5dp"         android:gravity="center"         android:background="@drawable/border"         android:id="@+id/symbol_no"          />  </linearlayout> <textview     android:layout_width="fill_parent"     android:layout_height="0dp"     android:text="rohit shrestha"     android:layout_weight="20"     android:textsize="30sp"     android:gravity="center"     android:id="@+id/name"     /> <relativelayout     android:layout_width="fill_parent"     android:layout_height="0dp"     android:layout_weight="20"     android:paddingleft="25dp"     android:paddingright="25dp"     android:id="@+id/parentblock">      <textview         android:layout_width="0dp"         android:layout_height="fill_parent"         android:text="block"         android:textsize="30sp"         android:gravity="center"         android:layout_alignparentleft="true"         android:layout_toleftof="@+id/block_no"         android:background="@drawable/border"/>      <textview         android:layout_width="120dp"         android:layout_height="fill_parent"         android:text="7"         android:gravity="center"         android:textstyle="bold"         android:layout_alignparentright="true"         android:textsize="40sp"         android:id="@+id/block_no"         android:background="@drawable/border"/>    </relativelayout> <linearlayout     android:orientation="horizontal"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_weight="10"     android:weightsum="100"     android:paddingleft="40dp"     android:paddingright="40dp"     android:paddingtop="30dp"     android:id="@+id/class_container"    >     <linearlayout         android:layout_weight="40"         android:orientation="vertical"         android:layout_width="wrap_content"         android:layout_height="fill_parent"         android:background="@drawable/border"         android:gravity="center"         >         <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="class"             android:textsize="30dp"             android:gravity="center"             android:id="@+id/class_text"            />         <textview             android:layout_width="100dp"             android:layout_height="wrap_content"             android:id="@+id/room_no"             android:textsize="25dp"             android:gravity="center"             android:text="8"/>      </linearlayout>     <linearlayout         android:orientation="vertical"         android:layout_weight="40"         android:layout_width="wrap_content"         android:layout_height="fill_parent"         android:background="@drawable/border"         android:gravity="center"         android:layout_marginleft="15dp">         <textview             android:layout_width="100dp"             android:layout_height="wrap_content"             android:text="seat"             android:gravity="center"             android:textsize="30dp"              android:id="@+id/seat_text"             />         <textview             android:layout_width="100dp"             android:layout_height="wrap_content"             android:text="8"             android:gravity="center"             android:id="@+id/seat_no"             android:textsize="25dp"            />          </linearlayout>    </linearlayout>  <textview     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:textsize="15dp"     android:text="good luck"     android:gravity="center"     android:id="@+id/display_notification"     android:layout_weight="10"     />  <textview     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:id="@+id/time_left"     android:text="5 hours go"     android:gravity="center"     android:textsize="20dp"     android:layout_weight="10"     />  <textview     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:textsize="10dp"     android:text="15 july,2015"     android:gravity="center"      android:layout_weight="10"/> 

this output :

enter image description here

try this:

button btn = (button)findviewbyid(r.id.symbol_no);     displaymetrics dis = getresources().getdisplaymetrics();      translateanimation anim = new translateanimation(0, 0, dis.heightpixels, 0);     anim.setduration(1000);     anim.setanimationlistener(new animationlistener()     {          @override         public void onanimationstart(animation arg0)         {           }          @override         public void onanimationrepeat(animation arg0)         {           }          @override         public void onanimationend(animation arg0)         {             // show whatever want show after animation finished.         }     });     btn.startanimation(anim); 

Comments