user3274539
user3274539

Reputation: 697

Android animation and layout stretch

I have a question, I am animating my top layout off the screen on button click, it is working as I want it to, however just under that layout I have another one, that is set to be below the top animated one. What I would like to have is whenever my layout is animated away that space is taken by that second layout, and whenever my layout comes in, it pushes the one under. Is it possible? If so, any tips on how would I accomplish such thing?

Upvotes: 0

Views: 487

Answers (1)

Shahzeb
Shahzeb

Reputation: 3734

The simple solution is to use RelativeLayout as main layout and don't position the inner layouts . keep the order in this way:

1- the one to be below
2- the one to be animated. 

In this way, the second one will always be at the top of first one unless it is animated out.

<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent">

<Layout 1>
<Layout 2(the animated one)>

</RelativeLayout>

In case if you didn't understand

Upvotes: 1

Related Questions