Android Templates

From The Oxygene Language Wiki
Jump to: navigation, search

This is a IDE topic about Oxygene for Java
 

Code Editor | Visual Designers | Build Toolchain | Debugging | Project Management | Templates

The June 2012 update of Oxygene for Java adds new templates for various Android XML resource types. These new templates take advantage of the new Android XML IntelliSense support. 16 new XML resource documents were added to the existing 3 templates of Fragment, Activity and Service.

The templates are accessible from the Add New Items dialog [Ctrl]+[Shift]+[A].

Add New Android Templates.png

Android Template Items

All of the XML documents must be in a specific folder, and the template automatically puts it there. The file names do not have any specific requirements, although by convention they often do.

  • Activity – Both an Activity class and a .layout-xml file. The .layout-xml file is placed in the /res/layout folder.
  • Fragment – Both a Fragment class and a .layout-xml file. The .layout-xml file is placed in the /res/layout folder.
  • Service – A Service class.
  • Clip Drawable – A drawable defined in XML that clips another drawable based on this Drawable's current level. You can control how much the child drawable gets clipped in width and height based on the level, as well as a gravity. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • Color State List – A ColorStateList is an object you can define in XML that you can apply as a color, but will actually change colors depending on the state of the View object to which it is applied. File location is the /res/color folder.
  • Frame Animation – An animation defined in XML that shows a sequence of images in order (like a film). File location is in the /res/drawable folder.
  • Inset Drawable – A drawable defined in XML that insets another drawable by a specified distance. This is useful when a View needs a background that is smaller than the View's actual bounds. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • Layer Drawable – A LayerDrawable is a drawable object that manages an array of other drawables. Each drawable in the list is drawn in the order of the list – the last drawable in the list is drawn on top. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • Layout XML File – A layout resource defines the architecture for the UI in an Activity or a component of a UI. File location is the /res/layout folder.
  • Level List Drawable – A Drawable that manages a number of alternate Drawables, each assigned a maximum numerical value. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • Application Menu – A menu resource defines an application menu (Options Menu, Context Menu, or submenu) that can be inflated with MenuInflater. File location is the /res/menu folder.
  • Preference Screen – An Android preference screen layout. File location is the /res/xml folder.
  • Property Animation set – An animation defined in XML that modifies properties of the target object, such as background color or alpha value, over a set amount of time. File location is the /res/animator folder.
  • Scale Drawable – A drawable defined in XML that changes the size of another drawable based on its current level. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • State List Drawable – A StateListDrawable is a drawable object defined in XML that uses several different images to represent the same graphic, depending on the state of the object. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • Transition Drawable – A TransitionDrawable is a drawable object that can cross-fade between the two drawable resources. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.
  • View Tween Animation Set – An animation defined in XML that performs transitions such as rotating, fading, moving, and stretching on a graphic. File location is in the /res/anim folder.
  • Values Resource File – A value resource to contain strings, colors, etc. File location is the /res/values folder.
  • XML Bitmap – An XML bitmap is a resource defined in XML that points to a bitmap file. The effect is an alias for a raw bitmap file. The XML can specify additional properties for the bitmap such as dithering and tiling. File location is the /res/drawable folder. Can be moved to a specific dpi drawable folder.

The View Tween Animation Set and Property Animation Set both have the same root element of <set> but have different allowed child elements. They are placed in different folders to differentiate them, but the IntelliSense cannot differentiate the folder. The templates contain a comment explaining the supported elements.

The Values Resource File can contain a large variety of different resource types, but by convention only contains one type of resource. For example, a file named strings.android-xml contains just <string>, <string-array> and <plurals> values, while a different file named colors.android-xml contains <color> values, etc.

Personal tools
Namespaces

Variants
Actions
Navigation
Getting Started
Sections
If you know
More
Toolbox