How to add .gif image or animation in Sketchware project?
1 minute read
GIF images can be used in Sketchware projects by loading in webview. To load a GIF image or animation in webview follow the steps below.
1. Add a webview in VIEW area of the project, at a location where the GIF image is supposed to appear. Set the layout_width and layout_height of webview to wrap_content.
2. Save and exit the project.
3. Open ES File Explorer, and add the GIF image (suppose it's name is spin.GIF) to folder:
sdcard/.sketchware/resources/sounds/639(specific to project)/
4. Open the resource file of the same project, located at sdcard/.sketchware/data/629(specific to project)/resource, using ES Note Editor.
5. In resource file, under @sounds add name of the GIF image as following code:
{"resFullName":"spin.GIF","resName":"spin","resType":1}
6. Save the file, and open the project in Sketchware.
7. In LOGIC area under onCreate event, add the block WebView loadUrl, and write:
file:///android_res/raw/spin.GIF
8. Save and run the project. The app will display a running GIF image.
1. Add a webview in VIEW area of the project, at a location where the GIF image is supposed to appear. Set the layout_width and layout_height of webview to wrap_content.
2. Save and exit the project.
3. Open ES File Explorer, and add the GIF image (suppose it's name is spin.GIF) to folder:
sdcard/.sketchware/resources/sounds/639(specific to project)/
4. Open the resource file of the same project, located at sdcard/.sketchware/data/629(specific to project)/resource, using ES Note Editor.
5. In resource file, under @sounds add name of the GIF image as following code:
{"resFullName":"spin.GIF","resName":"spin","resType":1}
6. Save the file, and open the project in Sketchware.
7. In LOGIC area under onCreate event, add the block WebView loadUrl, and write:
file:///android_res/raw/spin.GIF
8. Save and run the project. The app will display a running GIF image.