I need to create a bounce animation on a layout that contains a RecyclerView
and an ImageView
. To simplify the explanation here is an illustration of my current layout:
The RecyclerView
(Red) take all screen size, and under it I position an ImageView
(Green) that is not seen at the beginning. those two view are contained by a LinearLayout
(Blue) with a vertical orientations.
What I want to do is to move the LinearLayout
50dp up and then drop it back with the bounce animation so that the image view will be visible only during this animation.
The problem is that when I raise the LinearLayout
with this code:
mLayout.postDelayed(new Runnable() {
@Override
public void run() {
mLayout.animate().y(-500f);
}
}, 1000);
The ImageView is not shown, more over when I use the DDMS and get a snapshot of the XML layout after the move animation it looks like the image is not even part of the layout.
UPDATE: The xml layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:animateLayoutChanges="true"
android:theme="@style/AppTheme.MyTopics.Theme"
tools:mContext=".ui.fragments.MyTopicsFragment">
<include
android:id="@+id/toolbar_container"
layout="@layout/toolbar_timeline_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@id/toolbar_container">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager
android:id="@+id/vertical_recycler_view"
style="@style/NoOverScrollStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:rvp_singlePageFling="true"/>
</android.support.v4.widget.SwipeRefreshLayout>
<ImageView
android:id="@+id/first_time_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:layout_below="@+id/swipe_refresh"
android:background="@android:color/holo_green_dark"
android:src="@drawable/drawable_image_tutorial_background"/>
</LinearLayout>
<com.shellanoo.newsbot.ui.views.GeneralErrorView
android:id="@+id/no_data_errors_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:gev_no_data_view_layout="@layout/view_no_data_timeline"/>
<com.shellanoo.newsbot.ui.views.ProgressWheel
android:id="@+id/loading_pb"
style="@style/AppTheme.ProgressBar.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone"/>
<ImageView
android:id="@+id/my_topics_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_gravity="bottom|left"
android:paddingBottom="20dp"
android:paddingLeft="24dp"
android:paddingRight="30dp"
android:paddingTop="20dp"
android:visibility="gone"
app:srcCompat="@drawable/profile_main"
tools:visibility="visible"/>
<ImageView
android:id="@+id/add_topics_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|right"
android:paddingBottom="20dp"
android:paddingLeft="30dp"
android:paddingRight="24dp"
android:paddingTop="20dp"
android:visibility="gone"
app:srcCompat="@drawable/plus_main"
tools:visibility="visible"/>
<com.shellanoo.newsbot.ui.views.NewStoriesIndicatorView
android:id="@+id/new_items_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="8dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
tools:text="5 new items"/>
</RelativeLayout>
Does someone know why, and how this can be fixed?