https://github.com/m1ga/ti.svg
https://github.com/m1ga/ti.svg
android svg titanium-mobile titanium-module
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/m1ga/ti.svg
- Owner: m1ga
- License: other
- Created: 2020-05-09T11:22:04.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T11:40:06.000Z (over 2 years ago)
- Last Synced: 2025-03-29T01:13:02.169Z (about 2 months ago)
- Topics: android, svg, titanium-mobile, titanium-module
- Language: Java
- Homepage:
- Size: 8.79 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
:warning: currently not working - check https://fromzerotoapp.com/?s=svg for alternatives :warning:
# Titanium SDK - SVG Module (Android)
Basic module for loading SVG files on Android using Sharp (https://github.com/Pixplicity/sharp).
:warning: currently not working - check https://fromzerotoapp.com/?s=svg for alternatives :warning:
## Requirements
* Titanium SDK 9+
## Example
tiapp.xml
```xmlti.svg
```
Classic version:
```javascript
const Svg = require("ti.svg");var win = Ti.UI.createWindow({backgroundColor: "#fff"});
var svg = Svg.createSvgView({
image: "/test.svg",
width: 200,
height: 200,
borderColor: "#000",
borderWidth: 1
})
win.add(svg);
win.open();
```Alloy version:
```xml```
**Keep in mind**The image will be stretched into the view. So set the correct height/width!
## Hyperloop version
You can **use Hyperloop instead of this module** to load an SVG like this:
build.gradle
```
dependencies {
implementation 'com.pixplicity.sharp:library:1.1.2'
}
```
index.js
```javascript
import Activity from 'android.app.Activity';
import Sharp from "com.pixplicity.sharp.Sharp";const activity = new Activity(Ti.Android.currentActivity);
const Context = activity.getApplicationContext();
const AssetManager = Context.getAssets();function onClickShow(e) {
var fname = "/images/test.svg";
Sharp.loadAsset(AssetManager, "Resources" + fname).into($.img);
}$.index.open();
```
index.xml
```xml
```
## Author
- Michael Gangolf ([@MichaelGangolf](https://twitter.com/MichaelGangolf) / [Web](http://migaweb.de))