background preloader

Android dev w/ Titanium

Facebook Twitter

Custom Table View module for Android - ほし日記. Designing (and converting) for multiple mobile densities. With Apple leading the movement, phones, tablets, laptops, and desktop displays are rapidly increasing in resolution.

Designing (and converting) for multiple mobile densities

This is wonderful for everyday mobile users, as the quality of their device screens become sharper and allow them to better experience the finer details of an application. But this creates an interesting challenge — designing for multiple mobile densities. Understanding densities The sharpness of your phone or tablet’s display is referred to as density. iOS devices measure density in PPI (pixels per inch) and Android in DPI (dots per inch). The more pixels or dots you fit in one square inch on a screen, the higher the density and resolution of it. As mobile hardware evolves, so does the quality of screens. View full size As illustrated above, there are five widely used densities across iOS and Android devices, which fall into four progressively larger groups:

Android DPI Calculator. Supporting Multiple Screens. Android runs on a variety of devices that offer different screen sizes and densities.

Supporting Multiple Screens

For applications, the Android system provides a consistent development environment across devices and handles most of the work to adjust each application's user interface to the screen on which it is displayed. At the same time, the system provides APIs that allow you to control your application's UI for specific screen sizes and densities, in order to optimize your UI design for different screen configurations. Benbahrenburg/benCoding.Android.Tools. Alloy XML Markup. Introduction In Alloy, the XML markup abstracts the Titanium SDK UI components, so you do not need to code the creation and setup of these components using JavaScript and the Titanium SDK API.

Alloy XML Markup

All view files must be placed in the app/views folder of your project with the '.xml' file extension. During code compilation, Alloy looks for these markup files in this specific location to transform them into Titanium code, which can be executed by Studio and the CLI. The following code is an example of a view file: app/views/index.xml <Alloy><Window class="container"><Label id="label" onClick="doClick">Hello, World</Label></Window></Alloy> The Alloy tag is the root element for the XML markup and is required in all views. Within a controller, a UI component can be referenced if its ID attribute is defined. If the top-level UI component does not have an ID defined, it can be referenced using the name of the view-controller prefixed with a dollar sign and period ('$.'). Resources/app.js Model Element. New Defaults for Android Layouts in 1.7.

Supporting Multiple Platforms in a Single Codebase. Navigation with Back and Up. 一致的導覽是整體使用者體驗的必備組成。

Navigation with Back and Up

基本導覽的行為若不一致又令人意外,是最令使用者感到更沮喪的狀況。 Android 3.0 已將重大變更導入全域的導覽行為中。 完全遵循 [返回] 及 [上一層] 的方針,會讓使用者感到您的應用程式導覽既可靠又符合預期。 Android 2.3 和更早版本依賴系統 [返回] 按鈕,以支援應用程式內的導覽。 在 Android 3.0 導入動作列之後,出現第二個導覽機制:[上一層] 按鈕,由應用程式圖示和左指符號組成。 [上一層] vs. [上一層] 按鈕用於在畫面間有階層關係的應用程式中導覽。 如果畫面是在應用程式中的最頂端 (亦即應用程式的首頁),則不應該會有 [上一層]按鈕。 系統 [返回] 按鈕用於逆時間順序導覽,透過歷程記錄,可以經歷使用者最近使用過的畫面。 當先前檢視的畫面也是目前畫面的階層父項時,按下 [返回] 按鈕和按下 [上一層] 按鈕效果相同 — 這是常見的狀況。 [返回] 按鈕還支援幾個間接關聯畫面對畫面導覽的行為: 關閉浮動視窗 (對話、快顯)關閉內容相關的動作列,並從選取項目移除醒目顯示隱藏畫面鍵盤 (IME) 在應用程式內導覽 導覽至具有多重入口的畫面. Implementing Ancestral Navigation. Ancestral navigation is up the application's information hierarchy, where the top of the hierarchy (or root) is the application's home screen.

Implementing Ancestral Navigation

This navigation concept is described in Designing Effective Navigation . This lesson discusses how to provide ancestral navigation using the Up button in the action bar. Implement Up Navigation When implementing ancestral navigation, all screens in your application that aren't the home screen should offer a means of navigating to the immediate parent screen in the hierarchy via the Up button in the action bar. Figure 1. Regardless of how the current screen was reached, pressing this button should always take the user to the same screen in the hierarchy. To implement Up , enable it in the action bar in your activity's onCreate() method: @Override public void onCreate ( Bundle savedInstanceState ) { ... getActionBar (). setDisplayHomeAsUpEnabled ( true ); ... } You should also handle android.R.id.home in onOptionsItemSelected() .

Similarities and Differences in iOS & Android UX Design. When creating mobile applications, most application development efforts focus on the iOS and Android platforms, for fairly obvious reasons.

Similarities and Differences in iOS & Android UX Design

In October and November 2011, Android and iOS accounted for 90% of all smartphone sales (47% and 43%, respectively). While the platform with the majority of users may fluctuate over the next few years as both platforms continue to evolve, it’s safe to say that organizations will need to support application development for both platforms for the foreseeable future. Android Activity, Task, Stack, Launch mode. Android Activities and Tasks series – An introduction to Android’s UI component model. With Android, Google implemented its very own UI component model, introducing various new terms and concepts probably unfamiliar to most developers. Although well designed and powerful, it is unconventional, has a high learning curve and, in some respects, lacks sufficient documentation.

Basic use cases may be quick to implement, but in order to develop more complex applications, a thorough understanding of Android’s UI component model is essential. This series aims at providing this understanding while focusing on the UI related concepts of activities and tasks . Overview This series is composed out of four posts: TitaniumのAndroid用モジュールを作る カスタムViewモジュールの作成 - しそメモ(Titanium/Android/Ruby) TitaniumのAndroid用モジュールを作る カスタムViewモジュールの作成 今回は Titanium の モジュール 機能を利用してカスタムViewを作ります。 最低限必要な手順を整理したかったので、カスタマイズ内容は通常のViewクラスに色をつけるだけのシンプルな内容にしました。 プロジェクトの作成 TitaniumのAndroid用モジュールを作る その1 の手順に従って、 モジュール の テンプレート プロジェクトを作成します。