More Resource Types

More Resource Types

This page defines more types of resources you can externalize, including: Bool XML resource that carries a boolean value. Color XML resource that carries a color value (a hexadecimal color). Dimension XML resource that carries a dimension value (with a unit of measure). ID XML resource that provides a unique identifier for application resources and components. Integer XML resource that carries an integer value. Integer Array XML resource that provides an array of integers. Typed Array XML resource that provides

Continue Reading

Style Resource

Style Resource

A style resource defines the format and look for a UI. A style can be applied to an individual View (from within a layout file) or to an entire Activity or application (from within the manifest file). For more information about creating and applying styles, please read Styles and Themes. Note: A style is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine

Continue Reading

String Resources

String Resources

A string resource provides text strings for your application with optional text styling and formatting. There are three types of resources that can provide your application with strings: String XML resource that provides a single string. String Array XML resource that provides an array of strings. Quantity Strings (Plurals) XML resource that carries different strings for pluralization. All strings are capable of applying some styling markup and formatting arguments. For information about styling and formatting strings, see the section about

Continue Reading

Menu Resource

Menu Resource

A menu resource defines an application menu (Options Menu, Context Menu, or submenu) that can be inflated with MenuInflater. For a guide to using menus, see the Menus developer guide. FILE LOCATION: res/menu/filename.xml The filename will be used as the resource ID. COMPILED RESOURCE DATATYPE: Resource pointer to a Menu (or subclass) resource. RESOURCE REFERENCE: In Java: R.menu.filename In XML: @[package:]menu.filename SYNTAX: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android">     <item android:id="@[+][package:]id/resource_name"           android:title="string"      

Continue Reading

Layout Resource

Layout Resource

A layout resource defines the architecture for the UI in an Activity or a component of a UI. FILE LOCATION: res/layout/filename.xml The filename will be used as the resource ID. COMPILED RESOURCE DATATYPE: Resource pointer to a View (or subclass) resource. RESOURCE REFERENCE: In Java: R.layout.filename In XML: @[package:]layout/filename SYNTAX: <?xml version="1.0" encoding="utf-8"?> <ViewGroup     xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@[+][package:]id/resource_name"     android:layout_height=["dimension" | "match_parent" | "wrap_content"]     android:layout_width=["dimension" | "match_parent" | "wrap_content"]     [ViewGroup-specific attributes] >  

Continue Reading

Drawable Resources

Drawable Resources

A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon. There are several different types of drawables: Bitmap File A bitmap graphic file (.png, .jpg, or .gif). Creates a BitmapDrawable. Nine-Patch File A PNG file with stretchable regions to allow image resizing based on content (.9.png). Creates a NinePatchDrawable. Layer

Continue Reading

Color State List Resource

Color State List Resource

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. For example, a Button widget can exist in one of several different states (pressed, focused, or neither) and, using a color state list, you can provide a different color during each state. You can describe the state list in an XML file. Each color is

Continue Reading

Animation Resources

Android Animation Resource

An animation resource can define one of two types of animations: Property Animation Creates an animation by modifying an object’s property values over a set period of time with an Animator. View Animation There are two types of animations that you can do with the view animation framework: Tween animation: Creates an animation by performing a series of transformations on a single image with an Animation Frame animation: or creates an animation by showing a sequence of images in order with

Continue Reading

Android Buttons

Android buttons consists of text or an icon (or both text and an icon) that communicates what action occurs when the user touches it. Depending on whether you want a button with text, an icon, or both, you can create the button in your layout in three ways: With text, using the Button class: <Button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/button_text"     ... /> With an icon, using the ImageButton class: <ImageButton     android:layout_width="wrap_content"  

Continue Reading

Android Text Fields

Android Text Fields

A text field allows the user to type text into your app. It can be either single line or multi-line. Touching a text field places the cursor and automatically displays the keyboard. In addition to typing, text fields allow for a variety of other activities, such as text selection (cut, copy, paste) and data look-up via auto-completion. You can add a text field to you layout with the EditText object. You should usually do so in your XML layout with

Continue Reading

Sliding Sidebar

Subscribe For Latest Updates

Subscribe to our newsletter to get the latest scoop right to your inbox.