简体   繁体   English

离线HTML5或本机SDK,用于跨平台应用程序开发或JQUERY移动

[英]offline HTML5 or native SDK for cross-platform app development or JQUERY mobile

I am planning to build an app for selecting things from a menu and manipulating with it. 我打算构建一个应用程序,用于从菜单中选择内容并使用它进行操作。 I was earlier thinking of learning java and build on android, but then I came across HTML5 and JQuery mobile. 我之前想过学习java并在android上构建,但后来我遇到了HTML5和JQuery mobile。

Can anybody guide me what should I start learning? 任何人都可以指导我应该开始学习什么? I am planning to build a simple app. 我打算建立一个简单的应用程序。 I just want a good GUI and want to write once. 我只想要一个好的GUI并且想要写一次。 That's why I thought I'll work on HTML5 and then store it locally and open it in webview component of different platforms. 这就是为什么我认为我将使用HTML5然后将其存储在本地并在不同平台的webview组件中打开它。 So I will write once and use it on all platforms. 所以我会写一次并在所有平台上使用它。

Am I going in the right direction? 我正朝着正确的方向前进吗?
Also tell me the difference between HTML5, JQuery and Phonegap 还告诉我HTML5,JQuery和Phonegap之间的区别

I'll go through each of them in plain English. 我会用简单的英语通过他们每个人。

Phonegap is a set of API's to do things such as take a photo using the phones camera, use the devices accelerometer, geolocation etc.. Phonegap是一组API,用于执行诸如使用手机摄像头拍摄照片,使用设备加速度计,地理定位等等。

Basically, it is a way of communicating (through javascript) between your application and the device. 基本上,它是一种在应用程序和设备之间进行通信的方式(通过javascript)。 For example, to take a photo (open the camera) using Phonegap you would do something like: 例如,要使用Phonegap拍摄照片(打开相机),您可以执行以下操作:

navigator.camera.getPicture( cameraSuccess, cameraError, [ cameraOptions ] );

This is in essence no more difficult than opening the camera in a native device language (ie: Objective C for iOS), but the beauty is that this piece of code would work on multiple device platforms (there are one or two little tweaks you have to do per device, but it is basically write once and use multi platform). 这本质上并不比用本机设备语言打开相机困难(例如:iOS的Objective C),但美妙之处在于这段代码可以在多个设备平台上运行(你有一两个小调整)每个设备做,但它基本上写一次并使用多平台)。 So that's what Phonegap is. 那就是Phonegap。 It is a bunch of API's to communicate with multiple device platforms using the same code. 使用相同的代码与多个设备平台进行通信是一堆API。

jQuery , and more specifically in your case, jQuery mobile is a javascript library used mostly in user interface design (as well as Ajax). jQuery ,更具体地说,在你的情况下, jQuery mobile是一个主要用于用户界面设计(以及Ajax)的javascript库。 It makes it easier to perform animations (things like an image fading in, or moving across the screen), event handling (what happens when a user clicks, hovers, focuses on, an image or button or any element). 它可以更轻松地执行动画(诸如图像淡入或在屏幕上移动之类的事物),事件处理(当用户点击,悬停,聚焦,图像或按钮或任何元素时会发生什么)。 For example, look at the following piece of code: 例如,查看以下代码:

$('.mybutton').click(function(){
    $('#myelement').fadeOut(500);
});

Those 3 lines of code fade out a specific image when a user clicks on a specific button in 500 miliseconds. 当用户在500毫秒内点击特定按钮时,这3行代码淡出特定图像。 Short and sweet. 简短又甜蜜。 So that's exactly what jQuery is, a library that makes creating a nice UI easier. 所以这正是jQuery的一个库,它使创建一个漂亮的UI更容易。

jQuery mobile is (as the name suggests) aimed at mobile platform development. jQuery mobile (顾名思义)是针对移动平台开发的。 So besides the animations and events of jQuery, it includes functionality for touch and gestures (swipes etc..), as well as a great framework for handling pages and navigation within a mobile application. 因此除了jQuery的动画和事件之外,它还包括触摸和手势功能(滑动等等),以及用于处理移动应用程序中的页面和导航的强大框架。

HTML5 is the latest generation of HTML which is designed to provide a comprehensive application development platform for web based content that eliminates the need for 3rd party plugins like flash or java. HTML5是最新一代的HTML,旨在为基于Web的内容提供全面的应用程序开发平台,无需使用第三方插件,如flash或java。 Audio visual playback, drag and drop, local file storage with webSQL, and of course the canvas element for advanced drawing and animation. 音频视频播放,拖放,使用webSQL进行本地文件存储,当然还有用于高级绘图和动画的画布元素。

Basically it's just the new version of HTML which allows a lot more modern functionality. 基本上它只是新版本的HTML,它允许更多的现代功能。

Are you heading in the right direction? 你正朝着正确的方向前进吗? Yes, you definitely are. 是的,你绝对是。 While learning a mobile platforms native language has its perks and is well worthwhile, a lot of developers are turning to more universal platforms such as Phonegap. 虽然学习移动平台本地语言有其优势并且非常值得,但许多开发人员正在转向更通用的平台,如Phonegap。

A great place to start is right here (StackOverflow), and I would definitely suggest having a good read through the documentation for Phonegap and jQuery Mobile and playing around with some of the demos. 一个很好的起点就在这里(StackOverflow),我肯定会建议你仔细阅读PhonegapjQuery Mobile的文档并阅读一些演示。

Here are a few useful links on the subject: 以下是有关该主题的一些有用链接:

Good luck and have fun 祝好运并玩得开心点

Html5 is the raw information. Html5是原始信息。 Jquery (a part of Javascript) codes the interactive elements. Jquery(Javascript的一部分)对交互元素进行编码。 CSS is the design. CSS就是设计。 Keep them all separate, web standards etc. 保持它们所有单独的,Web标准等。

These technologies work for web-browsers, but non web-browsers cant read this code, like app stores etc. Phonegap packages this code so can be read on other platforms. 这些技术适用于Web浏览器,但非Web浏览器无法读取此代码,例如应用程序商店等.Phonegap打包此代码,因此可以在其他平台上阅读。 So rather than redoing the code many times - write once publish everywhere, or somethign like that. 因此,不要多次重做代码 - 写一次在任何地方发布,或者像这样写一些。 It can be seen in this picture: 从这张图中可以看出: http://phonegap.com/uploads/artwork/Build-Diagram-3.png

Phonegap is a framework which allows you to develop your application using HTML5, CSS and JavaScript and package it as a native app for each of the major mobile platforms. Phonegap是一个框架,允许您使用HTML5,CSS和JavaScript开发应用程序,并将其打包为每个主要移动平台的本机应用程序。 In theory you could write the application once and target the browser as well as the major mobile platforms (using Phonegap) with the same core codebase. 从理论上讲,您可以编写一次应用程序,并将浏览器以及主要的移动平台(使用Phonegap)与相同的核心代码库作为目标。

jQuery Mobile is a mobile development framework, built on HTML5, CSS and JavaScript which can be used in conjunction with Phonegap to build mobile apps. jQuery Mobile是一个基于HTML5,CSS和JavaScript的移动开发框架,可以与Phonegap结合使用来构建移动应用程序。 It provides a customisable, mobile-optimised user interface (think pages, headers, list items, form components) and a system for navigating between the pages of your application. 它提供可定制的,移动优化的用户界面(可以考虑页面,标题,列表项,表单组件)以及用于在应用程序页面之间导航的系统。

jQuery Mobile is dependant on the jQuery library which aims to make client-side scripting easier by papering over many of the browser inconsistencies which can make writing JavaScript difficult. jQuery Mobile依赖于jQuery库,该库旨在通过编写许多可能使JavaScript编写困难的浏览器不一致性来简化客户端脚本。 It's particularly useful for selecting HTML elements and traversing the DOM , and is in use on 50% of all websites according to this survey . 它对于选择HTML元素和遍历DOM特别有用,并且根据此调查在50%的所有网站上使用。

Based on your description of the application and your stated desire to write code once which will run on various platforms, I would say that you are definitely on the right track. 根据您对应用程序的描述以及您希望编写的代码,这些代码将在各种平台上运行,我会说您肯定是在正确的轨道上。

Since it is built on these technologies, I would suggest you begin by trying to get a solid grounding in HTML, CSS and jQuery before looking at jQuery Mobile. 由于它是基于这些技术构建的,因此我建议您在查看jQuery Mobile之前尝试在HTML,CSS和jQuery中获得扎实的基础。 I think you can probably ignore Phonegap for now safe in the knowledge that when you've built your application using the above technologies, you will be able to use the framework to package your application for the platforms you plan to target. 我认为您现在可以放弃Phonegap是安全的,因为当您使用上述技术构建应用程序时,您将能够使用该框架将您的应用程序打包到您计划定位的平台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM