android - Animate(ScaleAnimation) LinearLayout when it's height changes due to add/removal of view inside it -
i have linearlayout & have 2 textviews inside it. dynamically want hide 1 textview or can add textviews @ runtime. problem when textview disappears linearlayout collapses in no time. want animate linearlayout(scaleanimation) when views removed linearlayout.
activity_main.xml
<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:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <linearlayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:background="#000" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="1dp" android:background="#fff" android:orientation="vertical" android:padding="10dp" > <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="10dp" android:text="hello, world" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="10dp" android:text="hello, world 2" /> </linearlayout> </linearlayout> <button android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:text="remove textview" /> </relativelayout>
snapshot of layout...
i want animate linearlayout when second textview got removed linearlayout & if textview got added linearlayout. scaleanimation above task don't know values required type of animation.
pretty sure not need anymore, future searchers:
for remove animation, possible make item invisible using view.setvisibility(view.invisible)
, after animation (addanimationlistener
) effectually remove linear layout. when view invisible parent keeps measuring it.
Comments
Post a Comment