Android Widget using Cordova(使用 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 小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Cordova 的 Android 小部件
基础教程推荐
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01