NativeScript - 位图&帆布 [英] NativeScript - Bitmap & Canvas

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

问题描述

我是新的在nativescript应用程序开发。我想在NativeScript中使用 android.graphics.Bitmap android.graphics.Canvas 。我googled创建位图和绘制使用画布,但没有找到任何解决方案。基本上我想画矩形。请帮助我!

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 canvas = new android.graphics.Canvas ); 将构造一个空画布。
Bitmap也是如此,你可以使用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团队可能会帮助你比写任何本机Android / java在javascript中的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天全站免登陆