Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom CSS for Mobile development using Phonegap/Cordova

I´m planing to use Cordova v3 to develop a generic application to target mobile devices using HTML/CSS. Which is the best solution in order to reuse most of the html but having the visual style for each mobile platform? Which will be the best css/framework to use in this case (preferably free)?

Thanks in advance.

like image 390
JavierCaruso Avatar asked Nov 23 '13 03:11

JavierCaruso


People also ask

What is PhoneGap Cordova development?

In simple words use standard web development tools to create and deploy mobile applications from a single codebase across different platforms. Phonegap offers some additional enterprise services for the development and deployment of your Cordova application but in essence you will always be working with Cordova under the hood.

What is Adobe PhoneGap?

Adobe PhoneGap is a distribution of Apache Cordova and Cordova is an open-source mobile development framework that allows you to use standard web technologies — HTML5, CSS3, and JavaScript for cross-platform mobile development.

Why should you learn Apache Cordova for mobile development?

This is where becoming a well-versed Apache Cordova developer can come in handy by providing a way to develop mobile applications using standard web technologies—HTML5, CSS3, and JavaScript.

How do I build and run an app in Cordova?

Cordova provides several CLI steps for building and running your apps: cordova prepare, cordova compile, cordova build (which is a shortcut for the previous two), cordova emulate and cordova run (which incorporates build and can run emulator too).


3 Answers

As you said "but having the visual style for each mobile platform?" I understand you are searching for a native look in the apps. the other answers are good frameworks however unless you want to spend time tweaking css they will not look similar to a native UI (visually).

I have worked with Twitter bootstrap and jQM. So far so good but for a native UI look I will go for the following options which I think are the best. These are my top choices after spending a considerable time looking for a jQM alternative as I am not really happy with it in specific aspects.

EDIT: I am adding two new options based on my experience and what I have found so far (ionic and onsen ui).

Ionic Framework

http://ionicframework.com/

Intended to develop hybrid app using Angular JS is a really gem. I have been working with it and it has really helped me to develop faster than when using jQuery.

It also was UI elements that you can use out of the box and they are styled properly for iOS and Android although I think its style is more iOS-lish.

Pros

  • Angular JS based framework
  • Speed up the development process because of angular JS powers
  • Very well documented and a lot of examples and tutorials and recipes.
  • You could use the CSS without using angular if it is required
  • Free and open source
  • theming is done via CSS or SASS
  • Enough components out of the box to start building and app.

Cons

  • Maybe reading the ionic documentation and the Angular ties if you want to enjoy all of its powers, but it worth it.

Onsen UI

http://s.onsen.io/

I have not work yet with it but it looks like a really complete UI option for hybrid apps.

Pros

  • Work with Angular and jQuery was well
  • Free and Open SourceFree and Open Source
  • It has a theming tool which make easier to customize the look in case you are afraid of CSS or SASS.

Kendo UI mobile

http://www.kendoui.com/mobile.aspx

Pros

  • It help you create a native look with already native UI looking elements for Android, iOS, Windows Phone, BB.
  • Incorporates an MVC framework
  • Theming machine like jQM theme roller
  • Looks solid (I am looking forward to use it soon)
  • jQuery based so you can leverage the power of all jquery and JS libraries out there to solve specific problems very easily.

Cons

  • It is not free for commercial use.

PhoneJS

http://phonejs.devexpress.com

Pros

  • jQuery based so you can leverage the power of all jquery and JS libraries out there to solve specific problems very easily.
  • Optionally support Knockout.js for MVVM user interface development

Cons

  • Seems like its community is far less reduced in comparison with kendo, so I am not sure how much people are out there using it and that could help later.
  • It is not free for commercial use.

Chocolate chip UI

http://chocolatechip-ui.com

Pros

  • iOS 7, Android Jelly Bean and Windows Phone 8 UI looking
  • Open Source and the project looks active
  • jQuery compatible
  • ChocolateChip-UI uses its own JavaScript library, ChocolateChip, for DOM manipulation, Ajax requests, etc. It is very similar to jQuery. (they claim have better performance than jQuery and Zepto)

Cons

  • Doesn´t seems that have a wide community out there

Steroids

http://www.appgyver.com/steroids

If you feel like a adventure explorer take a took at steroids, which is cordova compatible and they claim you UI will perform as well as native. It is quite new, I haven´t give it a try but I seems promising, however as still is not widely used I did not decided to use it as having a lot of people using it is helpful when you face problems.

NOTE: If other have interesting alternatives to experiences with this or other UI frameworks for cordova/phonegap please share!

like image 178
VicM Avatar answered Nov 09 '22 10:11

VicM


My suggestion would be jQuery Mobile which supports almost all mobile devices in the market.

For the list of supported devices: http://jquerymobile.com/gbs/

1) It provides a native feel for each device platform. 2) Supports all platform 3) Easy support and 3rd party plugins

It's been said by some that jQuery mobile might be slow.. but you can tweak its settings to make it good.

like image 37
Purus Avatar answered Nov 09 '22 09:11

Purus


You could use Onsen UI. It claims to be faster than jQuery and has its own theme roller and is built to be compatible with PhoneGap/Cordova.

like image 31
Aneesh Avatar answered Nov 09 '22 10:11

Aneesh