繁体   English   中英

React Native Android中的Gif支持

[英]Gif support in React Native Android

Android的React Native不支持GIF? 如果要添加gif支持,该怎么办?

默认情况下,android react native应用程序不支持Gif图像。 您需要设置以下代码来显示gif图像。 代码:打开您的android / app / build.gradle文件,在以下位置添加以下代码

open android/app/build.gradle add the following  code 

dependencies: { 
  ...
     // For animated GIF support
    compile 'com.facebook.fresco:animated-base-support:0.11.0'  
    // For WebP support, including animated WebP
    compile 'com.facebook.fresco:animated-gif:0.11.0'  
    compile 'com.facebook.fresco:animated-webp:0.11.0' 
    compile  'com.facebook.fresco:webpsupport:0.11.0'  

那么您需要再次捆绑该应用。您可以通过两种方式显示gif图像。

   1-> <Image source={require('./../images/load.gif')}  style={{width: 100, height: 100 }}/>
   2-> <Image source={{uri: 'http://www.clicktorelease.com/code/gif/1.gif'}}  style={{width: 100, height:100 }}/>

我希望它对其他人有帮助,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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