[英]Lottie Animation is too small
I am using a lottie animation in my android app.我在我的 android 应用程序中使用了 lottie animation。 I downloaded the json file and pasted res/raw.
我下载了 json 文件并粘贴了 res/raw。 I am using it my app using XML and Java, but when I run the app, its size is very tiny compared to parent because I set width and height to
match_parent
.我在我的应用程序中使用它,使用 XML 和 Java,但是当我运行该应用程序时,它的大小与父级相比非常小,因为我将宽度和高度设置为
match_parent
。
Here is my code这是我的代码
<RelativeLayout
android:layout_marginTop="@dimen/margin5"
android:id="@+id/eight_relative"
app:layout_constraintTop_toBottomOf="@+id/seventh_relative"
android:layout_width="70dp"
android:layout_height="50dp">
<com.airbnb.lottie.LottieAnimationView
android:scaleType="centerCrop"
android:id="@+id/disk_encryption_switch"
android:layout_marginEnd="@dimen/margin30"
android:layout_alignParentEnd="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_rawRes="@raw/switch_animation"
/>
</RelativeLayout>
I changed the scale type and padding, but that didn't fix it.我更改了比例类型和填充,但这并没有解决问题。 How can I make it bigger?
我怎样才能让它变大?
I know it's bit late, but setting我知道有点晚了,但是设置
android:scaleX="2"
android:scaleY="2"
should work just fine.应该工作得很好。
Surely, you can scale any float value you need instead of 2
.当然,您可以缩放您需要的任何浮点值而不是
2
。
And obviously you may keep only scaleX
or scaleY
for 1-dimension scaling.显然,对于一维缩放,您可能只保留
scaleX
或scaleY
。
There is also android:scaleType="fitXY"
property set with the purpose of equal X/Y scaling, but I guess it's optional in the particular case.还有
android:scaleType="fitXY"
属性集,目的是进行相等的 X/Y 缩放,但我想在特定情况下它是可选的。
I am using lottie animation in my android app.我在我的 android 应用程序中使用了 lottie 动画。 I downloaded the json file and paster res/raw.
我下载了 json 文件并粘贴了 res/raw。 Then I am using it my app using XML and JAVA but when the run the app its size is very tiny as compared to parent becuase i set width and height
match_parent
Here is my code然后我使用它我的应用程序使用 XML 和 JAVA 但是当运行应用程序时它的大小与父级相比非常小因为我设置了宽度和高度
match_parent
这是我的代码
<RelativeLayout
android:layout_marginTop="@dimen/margin5"
android:id="@+id/eight_relative"
app:layout_constraintTop_toBottomOf="@+id/seventh_relative"
android:layout_width="70dp"
android:layout_height="50dp">
<com.airbnb.lottie.LottieAnimationView
android:scaleType="centerCrop"
android:id="@+id/disk_encryption_switch"
android:layout_marginEnd="@dimen/margin30"
android:layout_alignParentEnd="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_rawRes="@raw/switch_animation"
/>
</RelativeLayout>
I did a lot of search about it.我做了很多关于它的搜索。 I changed the scale type as well and padding as well but nothing changes.
我也更改了比例类型和填充,但没有任何变化。 Any kind of help would be appreciated
任何形式的帮助将不胜感激
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.