Android drawables and buttons

Introduction

Android icons are called drawables. They need to be drawn in multiple sizes for multiple screen resolutions (DPI).

The standard screen resolutions defined by Android are:

Android also supports 9-patch images which have fixed and expandable parts so they can be scaled nicely to any size. These images are used as background for views such as buttons.

Creating an Android drawable

  1. Open a graphic document.
  2. Should it have multiple pages or frames, select the page and frame you want to use.
  3. Choose the menu item Icon | Create Android drawable from image.
  4. Input the DPI for the source image.
  5. Put a check into the boxes corresponding to the resolutions you want to create.
  6. Click OK.

The resulting document will have multiple pages. Each page will have a DPI value set to the corresponding standard Android screen DPI value. It is recommended to save this document somewhere as a .gfie document to preserve pages and DPI information.

The final step is to export the pages to the resource folder of your Android project. Choose File | Export Android drawable. Here you have to provide the resource folder, i.e. the parent folder of the drawable-* directories.

Each page will be exported to the corresponding subfolder (drawable-ldpi, drawable-mdpi, etc.). The exported files will be named [title].png where [title] is what you input to the Android resource identifier field.

Testing a 9-patch image

See ninepatch.gfie under the GFIE Samples directory for an example 9-patch image.

Choose Icon | Test (Ctrl+Shift+T) and select the 9-patch tab to view your 9-patch image scaled to various sizes.

← Index