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:
IntelliJ IDEA composes the name for the new resource folder from the resource type and the qualifiers you choose, and creates a folder with this name under the res folder.
The name is built in compliance with the Android naming conventions.
-
In the Project tool window, right-click the
resnode where all Android resource definitions are stored. Select New | Android resource directory from the context menu. The New Resource Directory dialog box opens. -
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.
-
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
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
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.
-
From the Available Qualifiers list, select the required qualifier, and click the
-
If your application does not need to be compatible with various Android devices and, therefore, no multiple screens
IntelliJ IDEA generates the new folder with the compound name under the res node.
-
In the Project tool window, right-click the
resnode where all Android resource definitions are stored. Select New | Android resource file from the context menu. The New Resource File dialog box opens. -
Specify the name for the new resource definition file in the File name text box.
Follow the Android naming guidelines
-
From the Resource Type drop-down list, select the resource type
.
You can scroll through the list of resource types right from the File nametext box by using the Up and Down keyboard keys. -
To enable coding assistance, in the Root element field, specify the
http://schemas.android.com/apk/res/androidschema as the value of thexmlns:android. -
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
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
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.
-
From the Available Qualifiers list, select the required qualifier, and click the
-
If your application does not need to be compatible with various Android devices and, therefore, no multiple screens
-
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
resnode and saves the new resource definition file there.