Lottie-android: Scale best practice

Created on 8 Mar 2018  路  5Comments  路  Source: airbnb/lottie-android

Is it best practice to have a different dimension for the app:lottie_scale attribute? Right now i have a dimension declared in a dimens.xml file that is in /values-hdpi, /values-xhdpi, /values-xxhdpi, /values-xxxhdpi. Is that the right approach?

Most helpful comment

@lawloretienne You shouldn't ever need this. All values in your composition get converted to dps. If you want the animation to be a specific size, just set a fixed size on your LottieAnimationView and use scaleType="centerInside" or centerCrop

All 5 comments

@lawloretienne You shouldn't ever need this. All values in your composition get converted to dps. If you want the animation to be a specific size, just set a fixed size on your LottieAnimationView and use scaleType="centerInside" or centerCrop

But if this ends up clipping the lottie animation it is not what our designers had intended.

@lawloretienne it won't if you use centerInside

centerCrop only works with width="wrap_content" and height="wrap_content" not with fixed width and height.

@waqarv712 it works perfectly with fixed width and height just add lottie_scale="0.1".

Was this page helpful?
0 / 5 - 0 ratings