Before reading this article, please go through the article's link, mentioned below.
Apache Cordova
Apache Cordova is an open source project, which aims at allowing the mobile developers to build the Applications for all the major mobile platforms, using HTML, CSS and JavaScript technologies.
Monaca
Monaca is a software tool and Service solution to build and deploy HTML5 mobile hybrid apps. It is built on top of an open source Apache Cordova. Monaca provides a full-suite of resources including Cloud IDE, local development tools, debugger and back-end support.
Monaca's Cloud-based IDE builds HTML5 hybrid mobile apps for iOS, Android, Windows and Chrome Apps using HTML, CSS and JavaScript.
Monaca CLI provides Onsen UI templates, device debugger, remote building and any Service, which you might need directly from your terminal.
Onsen UI framework
Onsen UI is a front-end UI framework for developing cross-platform mobile apps, using Apache Cordova and PhoneGap. It’s fully independent of the frameworks - you can easily plug these components into any project, regardless of JavaScript framework.
Onsen UI templates can be used with Visual Studio 2015. All the templates are compatible for Visual Studio Tools for Apache Cordova. It works pretty well with Windows Universal, iOS and Android apps.
Templates Included in Onsen UI Framework
It is packed with the following 4 templates. Each template has JavaScript and TypeScript variants.
- Onsen UI Blank
It contains the Blank app.
- Onsen UI Navigation
It contains a navigator with a master and detail page.
- Onsen UI Splitter
It contains a side menu navigation.
- Onsen UI Tab Bar
Tab bar style navigation.
Building Tab Bar Apps with Onsen UI Framework
Let’s see how to start building Tab BaraApp with Onsen UI framework, using Visual Studio 2015.
Prerequisites
- Visual Studio 2015.
- Visual Studio Tools for Apache Cordova.
Follow the steps, mentioned below to build Onsen UI Tab Bar app, using Onsen UI framework, using Visual Studio 2015.
Step 1
Create an Onsen UI App
Let’s be ready to create a New Project. Open Visual Studio 2015 and click File -> New -> Project Option for New Apache Cordova App, using Onsen UI framework.
Step 2
Give the Project Name
New Project Window will open. Subsequently, you can select an Installed -> Template -> JavaScript -> Manoca ->Onsen UI Navigation.
Type Project name Onsen UI Tabbar app and click OK button.
Step 3
Main screen is shown below.
Step 4
Afterwards, we create the project. Our solution should resemble, as shown below.
This table gives the basic idea of how we might use each one.
File |
Why is it in your project? |
Merge Folder |
It contains the Package for Android, iOS and Windows app. |
www |
This file contains the images, library and JS files. |
config.xml |
Contains the settings of our app. |
taco.json |
Defines which version of the Cordova CLI Visual Studio uses to build the project. |
Step 5
Adding the coding
- Adding the Simple User Text
Go to the index.html in the solution Bar and add HTML coding.
Coding
<br />Welcome to Onsen UI Tab Bar App, using Visual Studio 2015 <br />
Step 6 Creating Home Page
Go to the www->index.html in the Solution Bar and add HTML coding.
Let’s see how to design the page, mentioned below.
Coding |
Explanation |
<ons-template id="home.html"> |
Create a template. |
<ons-page id="home-page"> |
Add the page. |
<ons-toolbar> |
Create the toolbar. |
<ons-list> |
Create the list. |
<ons-list-item tappable onclick="alertMessage()"> |
Add the list to the item. If you click on the list, it will open the alert message. |
<div class="list__item__title"> |
Add the list title. |
<div class="list__item__subtitle"> |
Add the subtitle to the list. |
Now, edit the user data on the templates.
Likewise, we add the remaining data.
Coding
- <ons-template id="home.html">
- <ons-page id="home-page">
- <ons-toolbar>
- <div class="left">
- <ons-toolbar-button onclick="alertMessage()">
- <ons-icon icon="ion-compose"></ons-icon>
- </ons-toolbar-button>
- </div>
- <div class="center">Home</div>
- </ons-toolbar>
- <!-- This list will be filled on page initialization --><br /> Welcome to Onsen UI Tab Bar App Using Visual Studio 2015 <br />
- <ons-list>
- <ons-list-item tappable onclick="alertMessage()">
- <div class="left">
- <div class="list__item__thumbnail picture"></div>
- </div>
- <div class="center">
- <div class="list__item__title">Apple</div>
- <div class="list__item__subtitle">Delicious and crunchy, apple fruit is one of the most popular and favorite fruits among the health conscious, fitness lovers who firmly believe in the concept of “health is wealth.</div>
- </div>
- </ons-list-item>
- </ons-list>
- <ons-list>
- <ons-list-item tappable onclick="alertMessage()">
- <div class="left">
- <div class="list__item__thumbnail picture"></div>
- </div>
- <div class="center">
- <div class="list__item__title">Bananna</div>
- <div class="list__item__subtitle">A banana is a curved, yellow fruit with a thick skin and soft sweet flesh</div>
- </div>
- </ons-list-item>
- </ons-list>
- <ons-list>
- <ons-list-item tappable onclick="alertMessage()">
- <div class="left">
- <div class="list__item__thumbnail picture"></div>
- </div>
- <div class="center">
- <div class="list__item__title">Cherry</div>
- <div class="list__item__subtitle">A small fruit, usually red, black or yellow, with a smooth hard seed and a short hard stem.</div>
- </div>
- </ons-list-item>
- </ons-list>
- <ons-list>
- <ons-list-item tappable onclick="alertMessage()">
- <div class="left">
- <div class="list__item__thumbnail picture"></div>
- </div>
- <div class="center">
- <div class="list__item__title">Grapes</div>
- <div class="list__item__subtitle">A grape is a fruiting berry of the deciduous woody vines of the botanical genus Vitis.</div>
- </div>
- </ons-list-item>
- </ons-list>
- </ons-page>
- </ons-template>
Step 7 Creating Second Screen
Go the www->index.html in the Solution Bar and add HTML coding.
Lets see how to design the Setting screen, mentioned below.
Coding |
Explanation |
<ons-row class="profile-wrapper"> |
Create the row. |
<ons-col width="60px"> |
Create the column with width size. |
<div class="list__item__thumbnail picture"> |
Add the thumbnail. |
<div class="profile-name"> |
Add the caption. |
<div class="profile-email"> |
Add the Email ID. |
<div class="settings-header"> |
Create a header. |
<ons-list modifier="inset" class="settings-list"> |
Create the list. |
<ons-list-item modifier="longdivider"> |
Add the items to the list. |
<label class="center" for="twitter-switch"> |
Insert the label that switch to other file. |
- Designing the Second page Facebook, Terms of Service
Now, we set the thumbnail, set the name and mail ID. Subsequently, we create the toggle button also.
- Designing the Second page – Privacy Policy and Sign out
Now, we design the privacy policy and sign out options.
Step 8
Run the Application
Now, we are ready to run our Project. Thus, click the Ripple – Nexus (Galaxy) to run the Application. (Apache Ripple is a free mobile simulator).
Output
Main Screen Timeline Window is shown below.
Output 1
Setting Window is shown below.
Output 2
Tabbed Window is shown below.
Output 3
Add the User text is shown below.
Output 4
After Editing User text is shown below.
Conclusion
I hope, you understood how to start the Onsen UI Tab Bar app, using Visual Studio 2015 and how to run it.