Android animate visibility change for two views at once -


i want hide 2 views (a viewpager , linearlayout) @ once when button clicked. tried using android:animatelayoutchanges="true", start hiding viewpager first , linearlayout, doesn't good.

how can manually hide both views @ same time? have seen examples visibility of 1 view changed:

myimageview.animate()         .translationy(myimageview.getheight())         .alpha(0.0f)         .setduration(300)         .setlistener(new animatorlisteneradapter() {             @override             public void onanimationend(animator animation) {                 super.onanimationend(animation);                 myimageview.setvisibility(view.gone);              }         }); 

is there way chain 2 animate() calls of different viewsto trigger them simultaneously?

edit: layout file, views want hide @ same time viewpagerwith id viewpager , linearlayout id ll_indicators:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/main_content"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:animatelayoutchanges="true"     android:fitssystemwindows="true"     android:orientation="vertical">      <include         android:id="@+id/toolbar"         layout="@layout/toolbar" />      <include         android:id="@+id/tv_statusbar"         layout="@layout/layout_statusbar"         android:layout_width="match_parent"         android:layout_height="@dimen/statusbar_height" />      <textview         android:id="@+id/tv_title"         android:layout_width="match_parent"         android:textcolor="@color/black"         android:text="@string/some_text"         android:padding="10dp"         android:textsize="@dimen/fontsizemedium"         android:gravity="center_horizontal"         android:layout_height="wrap_content" />      <android.support.v4.view.viewpager         android:id="@+id/viewpager"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1"         app:layout_behavior="@string/appbar_scrolling_view_behavior" />      <linearlayout         android:id="@+id/ll_indicators"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center"         android:orientation="horizontal">         <imageview             android:id="@+id/intro_indicator_0"             android:layout_width="8dp"             android:layout_height="8dp"             android:layout_marginend="@dimen/activity_margin_half"             android:layout_marginright="@dimen/activity_margin_half"             android:background="@drawable/indicator_unselected" />          <imageview             android:id="@+id/intro_indicator_1"             android:layout_width="8dp"             android:layout_height="8dp"             android:layout_marginend="@dimen/activity_margin_half"             android:layout_marginright="@dimen/activity_margin_half"             android:background="@drawable/indicator_unselected" />     </linearlayout>      <include         android:id="@+id/ll_login"         android:layout_weight="0"         layout="@layout/item_login"         android:layout_width="match_parent"         android:layout_height="wrap_content">     </include> </linearlayout> 

since didn't post layout, if can put viewpager , linearlayout in 1 layout, (for example inside relativelayout) can animate that.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -