android - Scale a layout to match parent with animation -
in sample project have linear layout, height set wrap content in xml , there fragment below takes remaining space. fragment contains button when clicked remove fragment , height of linear layout set match parent. tried adding android:animatelayoutchanges="true"
transition wrap_content match_parent not smooth. how can animate android:layout_height="wrap_content"
android:layout_height="match_parent"
here layout
<linearlayout 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="@drawable/bg" android:orientation="vertical" android:id="@+id/layoutroot" tools:context=".mainactivity"> <linearlayout android:layout_width="match_parent" android:id="@+id/cloudholder" android:orientation="vertical" android:animatelayoutchanges="true" android:gravity="center" android:layout_height="wrap_content"> <imagebutton android:layout_width="100dp" android:layout_gravity="center" android:layout_height="100dp" android:background="@drawable/play"/> </linearlayout>
you may need try adding android:animatelayoutchanges="true" in parent layout example:
<linearlayout 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="@drawable/bg" android:orientation="vertical" android:animatelayoutchanges="true" android:id="@+id/layoutroot" tools:context=".mainactivity"> <linearlayout android:layout_width="match_parent" android:id="@+id/cloudholder" android:orientation="vertical" android:gravity="center" android:layout_height="wrap_content"> <imagebutton android:layout_width="100dp" android:layout_gravity="center" android:layout_height="100dp" android:background="@drawable/play"/> </linearlayout> </linearlayout>
if above code doesn't work, might need take at:
animation of height of linearlayout container valueanimator
or
Comments
Post a Comment