On Android: how to determine the right animation to maximize one view while minimizing the other two?

I created an action that contains 3 custom components (defined in xml). 2 components expand the view, 1 extends the SurfaceView. All of them are in LinearLayout, which allows you to split the screen real estate equally between the components. Click to view. I am new, so I can not send images directly ...

Now, I would like to maximize one view when it is clicked (using sliding animation). The remaining two should push to the bottom. Everything should start at the same time, and the animation should be kept at the maximum magnification of the desired view.

I created two animations (res / anim): shrink_view.xml and max_view.xml

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromYDelta="0" android:toYDelta="100%p" android:duration="4000" /> <scale android:fromXScale="1" android:toXScale="1" android:fromYScale="1" android:toYScale="0.0" android:pivotX="0%" android:pivotY="50%" android:fillAfter="false" android:startOffset="0" android:duration="4000" android:fillBefore="true" /> </set> <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromYDelta="0" android:toYDelta="100%p" android:duration="4000" /> <scale android:fromXScale="1" android:toXScale="1" android:fromYScale="1" android:toYScale="100" android:pivotX="100%" android:pivotY="100%" android:startOffset="0" android:duration="4000" android:fillBefore="true" /> </set> 

But that does not do what I want. I think my attempt may be dead. So can anyone help?

+4
source share
1 answer

I have not tried what you are doing, but you can find this . This is a tutorial on how to liven up changing views on a button. It uses a ViewFlipper widget to change between ViewGroups (e.g. LinearLayouts or RelativeLayouts that contain TextViews, Buttons, etc.), using some built-in animations. This is slightly different from your situation, as it changes the entire screen to its animation, but it can put you on the right track.

+2
source

Source: https://habr.com/ru/post/1303575/


All Articles