使用 Cordova 的 Android 小部件 [英] Android Widget using Cordova

查看:22
本文介绍了使用 Cordova 的 Android 小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划将一些最小的功能捆绑到一个应用程序或 Android 设备的小部件中.然而,转念一想,我意识到我以前从未听过/读过有人用 Cordova/Phonegap 构建小部件.我用谷歌搜索了一下,答案似乎暗示了不".我阅读了Phonegap主页上的描述,它说它基本上允许用户构建应用程序.

I am planning to bundle together some minimal functionality into an app or a widget for android devices. However on second thought I realized that I have never heard/read someone building a widget with Cordova/Phonegap before. I googled a bit and the answers seem to be suggesting a 'no'. I read the description on the home page for Phonegap and it says that it allows users to build apps basically.

那么,请有人指出我是否可以在 Cordova 中创建一个 android 小部件的正确方向.如果不是,小部件在概念上/实际上与应用程序有何不同.

So, could someone please point me in the right direction as to wether its possible to create an android widget in Cordova. And if no, how is an widget conceptually/practically different from an app.

PS:也许我在这里使用了一些不正确的术语.我所说的小部件是 这个.它主要在主屏幕上以半透明条形式显示.

PS: just maybe i am using some incorrect terminology here. What I mean by a widget is this. Its something that sticks on the home screen mostly in a translucent bar.

推荐答案

小部件是在应用程序屏幕上扩展视图的 android 原生结构.

Widgets are android native constructs that extend a view on the application screen.

http://developer.android.com/reference/android/widget/package-summary.html

cordova/phonegap 应用是带有 webview 支持的应用.注意:webview 不是 android 原生视图.

A cordova/phonegap app is an app with a webview backing. Note: webview not android native view.

直到有人找到一种方法来构建嵌入 web 视图的本机小部件,那么到目前为止你所听到的都是正确的......即不".

Until someone finds a way to construct a native widget that embeds a webview, then what you have been told so far is correct... i.e. "no".

http://cordova.apache.org/docs/en/4.0.0/guide_overview_index.md.html#Overviewhttp://cordova.apache.org/docs/en/4.0.0/guide_hybrid_webviews_index.md.html#Embedding%20WebViewshttp://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_webview.md.html#Android%20WebViews

是"可以想象你可以有一个与你的cordova项目相关联的小部件,但是你会在cordova旁边编写android本机代码......大多数人会认为这违背了使用cordova的目的,除非你只针对安卓.在这种情况下,我必须问这个问题:

It "is" conceivable you could have a widget associated with your cordova project, but then you would be writing android native code alongside cordova.... most people would see this as defeating the point of using cordova, unless you are ONLY targeting android. In which case I have to ask the question:

您是在使用 cordova 作为在 android 上启动应用程序编码的一种更简单的方式,还是在尝试利用 cordova 的便利性来跨多个平台共享代码库?"

"Are you using cordova as an easier way to start app coding on android or are you trying to leverage the convenience of cordova to share a code base across multiple platforms?"

如果是前者,那就写一个原生应用.如果是后者,那么 cordova 不会(轻易)给你小部件,也不会跨平台小部件

If it's the former, then just write a native app. If it's the latter, then cordova isn't going to (easily) give you widgets, nor cross platform widgets

这篇关于使用 Cordova 的 Android 小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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