简体   繁体   English

在firemonkey应用程序中播放gif图片动画

[英]Play gif picture animation inside firemonkey application

How I can play gif picture animation using Firemonkey that will be used in Android and iOS app ? 如何使用将在Android和iOS应用程序中使用的Firemonkey播放gif图片动画?

I am using Delphi XE 8. 我正在使用Delphi XE 8。

Note: I saw this question Animated GIF in Firemonkey but I dont have the animation as sprites only as a single gif file. 注意:我在Firemonkey中看到了这个问题Animated GIF,但是我没有将动画作为精灵仅作为单个gif文件使用。

Due to how Firemonkey works with images and bitmaps, TGIFImage doesn't exist anymore. 由于Firemonkey如何处理图像和位图,因此TGIFImage不再存在。

So the easiest way of doing this is by using a TWebBrowser component and then loading your .gif file into that component 因此,最简单的方法是使用TWebBrowser组件,然后将.gif文件加载到该组件中

For Firemonkey Apps you can set the deployment of files for each different platform, but in the case of a Windows Firemonkey App you can add your .gif files to your project and then set the URL to the local file (or you can set it to a remote URL if you want to use a gif that you don't have) 对于Firemonkey Apps,您可以为每个不同的平台设置文件的部署,但是对于Windows Firemonkey App,可以将.gif文件添加到项目中,然后将URL设置为本地文件(或者将其设置为远程URL(如果要使用您没有的gif)

And to get your gif in the browser for Win simply set the gif as the URL 要在Win浏览器中获取gif,只需将gif设置为URL

WebBrowser1.URL := 'file://'+ ExtractFilePath(ParamStr(0))+'images\somegif.gif';
WebBrowser1.Navigate;

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

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