IntelliJ IDEA 14.0.0 Web Help

Creating Resources

Besides the standard way to create files and folders, you can create resource definitions right from the res node without having to place them in the corresponding folder. IntelliJ IDEA detects the type and the qualifier of the new resource and appoints the folder where the resource definition file will be saved. You can create separate resource definition files and entire folders.

In this topic:

Creating a resource folder

  1. In the Project tool window, right-click the res node where all Android resource definitions are stored. Select New | Android resource directory from the context menu. The New Resource Directory dialog box opens.
  2. From the Resource Type drop-down list, select the type of resources to be stored in the new folder. The selected type is displayed in the Directory name field.
  3. Do one of the following:
    • If your application does not need to be compatible with various Android devices and, therefore, no multiple screens support is required, just click OK.
    • To provide alternative resources, specify the resource qualifiers that define a specific device configuration.
      • From the Available Qualifiers list, select the required qualifier, and click the icon_InsertReplace.gif button. The selected item is added to the Chosen qualifiers list. Depending on a particular qualifier, either specify its value manually, or choose the required value from the drop-down list next to Chosen qualifiers.
      • To remove a qualifier, select it in the Chosen qualifiers list and click the icon_InsertReplace2.gif button.

      IntelliJ IDEA appends all selected qualifiers to the resource type with the dash character as a separator. The resulting name is shown in the Directory name field.

Creating a resource definition file in the relevant resource folder

  1. In the Project tool window, right-click the res node where all Android resource definitions are stored. Select New | Android resource file from the context menu. The New Resource File dialog box opens.
  2. Specify the name for the new resource definition file in the File name text box.
  3. From the Resource Type drop-down list, select the resource type.
  4. Do one of the following:
    • If your application does not need to be compatible with various Android devices and, therefore, no multiple screens support is required, just click OK.
    • To provide alternative resources, specify the resource qualifiers that define a specific device configuration.
      • From the Available Qualifiers list, select the required qualifier, and click the icon_InsertReplace.gif button. The selected item is added to the Chosen qualifiers list. Depending on a particular qualifier, either specify its value manually, or choose the required value from the drop-down list next to Chosen qualifiers.
      • To remove a qualifier, select it in the Chosen qualifiers list and click the icon_InsertReplace2.gif button.

      IntelliJ IDEA appends all selected qualifiers to the resource type with the dash character as a separator. The resulting name is shown in the Directory name field.

  5. Click OK, when ready. IntelliJ IDEA composes the name of the resource folder where the new file is going to be saved. The name is built from the specified resource type and the qualifier in compliance with the Android naming conventions. If such folder exists already, IntelliJ IDEA saves the new file in it. If no such folder is found, IntelliJ IDEA creates it under the res node and saves the new resource definition file there.

See Also

Last modified: 12 November 2014
comments powered by Disqus