android - Increase height of linear layout by animation -


i want increase height of linear layout after 2 seconds. when activity loaded app should wait 2 seconds height of linear layout should increase 200dp 300dp. xml code shown below.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fffafaf9" android:clipchildren="false"   tools:context=".mainactivity">  <textview android:text="@string/hello_world"     android:id="@+id/top"     android:layout_width="wrap_content"     android:layout_height="60dp"     android:paddingtop="30dp"     android:paddingleft="20dp"     />  <view     android:layout_width="fill_parent"     android:layout_height="2dp"     android:layout_below="@id/top"     android:background="#ffd3d3d2" /> <linearlayout android:layout_width="fill_parent"     android:layout_height="200dp"     android:layout_alignparentbottom="true"     android:orientation="vertical">      <view     android:id="@+id/temp_view"     android:layout_width="100dp"     android:layout_height="100dp"     android:visibility="visible"     android:translationz="20dp"      android:layout_gravity="center_horizontal"     android:background="@drawable/circle_shape"     />  <linearlayout      android:layout_width="fill_parent"     android:layout_height="200dp"     android:layout_margintop="-80px"     android:background="#ffe4e4e3"     android:elevation="-10dp"     android:alpha="0.5"     android:layout_below="@id/temp_view"     > 

</linearlayout> 

you can write custom linearlayout this:

public class customlinearlayout extends linearlayout {  private int mlayoutheight;  public customlinearlayout(context context, attributeset attrs) {     super(context, attrs); }  public void setlayoutheight(int height) {     mlayoutheight = height;     viewgroup.layoutparams lp = getlayoutparams();     lp.height = height;     setlayoutparams(lp); }  public int getlayoutheight() {     return mlayoutheight; } 

}

then find linearlayout in activity , start animation:

 customlayout = (customlinearlayout) findviewbyid(r.id.cl);     objectanimator oa = objectanimator.ofint(customlayout, "layoutheight", densityutil.dip2px(this, 200), densityutil.dip2px(this, 300));     oa.setduration(2000);     oa.start(); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -