NativeScript - 位图和放大器;帆布 [英] NativeScript - Bitmap & Canvas

查看:135
本文介绍了NativeScript - 位图和放大器;帆布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在nativescript应用开发新的。我想在NativeScript使用 android.graphics.Bitmap android.graphics.Canvas 。我GOOGLE了用于创建位图和用帆布画,但没有找到任何解决办法。基本上,我想提请矩形。请帮帮我!

I am new in nativescript app development. I want to use android.graphics.Bitmap and android.graphics.Canvas in NativeScript. I googled for creating bitmap and draw it using canvas, but didn't find any solution. Basically i want to draw rectangle. Please help me!

在此先感谢:)

这是从Android应用程序的结果,同样需要在NativeScript实现。

This is the result from Android app and same is required to implement on NativeScript.

在这里输入的形象描述

推荐答案

有关画布你的JavaScript将需要是这样的:

For the canvas your javascript would need to be something like:

VAR帆布=新android.graphics.Canvas(); ,将构建一个空白的画布。
这同样适用于位图,你可以使用它使用抽象下位图图像NativeScript模块。另一种选择是,你可以做到这一切的,没有任何原生Android电话而只使用在您的主要布局的NS图像。然后用手势模块中的其他图像拖。

var canvas = new android.graphics.Canvas(); that would construct an empty canvas. The same goes for the Bitmap, you could use the NativeScript image module which uses bitmaps under the abstraction. Another option is you could achieve all of this without any native android calls and just use the NS image on your main layout. Then use the gestures module to drag in that other image.

该职位从NS团队可能会帮助你胜过一切,虽然有写JavaScript中的原生Android / JAVA的应用NativeScript。 https://docs.nativescript.org/runtimes/android/marshalling /java-to-js.html

This post from the NS team might help you more than anything with writing the native android/java in javascript for a NativeScript app though. https://docs.nativescript.org/runtimes/android/marshalling/java-to-js.html

这篇关于NativeScript - 位图和放大器;帆布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆