简体   繁体   中英

How to change CardView size with animation?

I have a CardView in my layout and I want to make its width and height bigger with this fancy material style animation like in this video

I tried to use something like cardView.animate().scaleX(1.2f).scaleY(1.2f) but it scales view with its content, but I need just change the size of CardView.

Add a container <RelativeLayout> , <FrameLayout> or <LinearLayout with fixed dimensions and layout_gravity set to center , and put the contents of the card in there. This container will float in the center, keeping the dimensions you specify, no matter how big the card gets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM