App resources such as bitmaps and layouts are organized into type-specific
directories inside each module's res/ directory. You can also add alternative
versions of each file that that are optimized for different device
configurations (such as a high-res version of a bitmap for high-density
screens).
Android Studio helps you add new resources and alternative resources in several
ways, depending on the type of resource you want to add. This page describes how
to add generic XML files or resource directories to your project. You might
instead want to see the following pages for information about other
resource types:
Directory name: ディレクトリは、リソースタイプと構成修飾子の固有の方法で名前を付ける必要があります。
そのため、ディレクトリ名に構成修飾子を手動で追加しないのであればこれは編集しないでください(代わりに Available qualifiers を見てください)。
Available qualifiers: layoutディレクトリの構成修飾子を入力するのではなく、左側の一覧から修飾子をクリックして選び、 Add をクリックします。
必要な修飾子を全て追加したら、OKをクリックします。
ヒント:res フォルダ内の既存のリソースディレクトリを右クリックし、New > type resource fileを選びます。
こうすることで、希望のリソースタイプ固有の簡略版New Resource Fileダイアログが開きます。
Add an XML Resource File
Although the pages linked above describe workflows that are customized to each
type of resource, you can add any XML resource file by following these
steps:
Click the target app module in the Project window (while in either
the Android or Project view), and then select File > New >
Android resource file.
Fill in the details in the dialog:
File name: Type the name for the XML file (does not require the
.xml suffix).
Resource type: Select the type of resource you want to create.
Root element: If applicable, select the root XML element for the
file. Some resource types support only one type of root element, so
depending on the type selected above, this might not be editable.
Source set: Select the source set where you want to save the file.
Directory name: The directory must be named in a way that's specific
to the resource type and configuration qualifiers. So you should
not edit this unless you want to add configuration qualifiers to the
directory name by hand (see Available qualifiers instead).
Available qualifiers: Instead of typing configuration qualifiers for
your layout directory, you can add them by clicking a qualifier from the
list on the left, and then clicking Add .
Once you've added all the qualifiers you want, click OK.
Tip: Right-click an existing resource directory within
the res folder and select New > type resource file.
This opens a simplified version of the New Resource File dialog that's
specific to your desired resource type.
リソースディレクトリを追加する
新規にリソースディレクトリを追加する必要がある場合、以下の手順に沿って作業します:
Project ウィンドウ内で対象のアプリモジュールをクリックし、File > New > Android resource directoryの順で選びます。
ダイアログ内の各詳細情報を記載します:
Directory name: ディレクトリは、リソースタイプと構成修飾子の固有の方法で名前を付ける必要があります。 そのため、ディレクトリ名に構成修飾子を手動で追加しないのであればこれは編集しないでください (代わりに Available qualifiers を使ってください)。
Resource type: 作成したいリソースのタイプを選びます。
Source set: 配置したいsource set を選びます。
Available qualifiers: layoutディレクトリの構成修飾子を入力するのではなく、左側の一覧から修飾子をクリックして選び、 Add をクリックしてください。
必要な修飾子を全て追加したら、OKをクリックします。
Add a Resource Directory
If you need to add a new resource directory, follow these steps:
Click the target app module in the Project window, and then select
File > New > Android resource directory.
Fill in the details in the dialog:
Directory name: The directory must be named in a way that's specific
to the resource type and combination of configuration qualifiers. So you
should not edit this unless you want to add configuration qualifiers to the
directory name by hand (use Available qualifiers instead).
Resource type: Select the type of resource you want to create.
Source set: Select the source set where you want the layout.
Available qualifiers: Instead of typing configuration qualifiers for
your layout directory, you can add them by clicking a qualifier from the
list on the left, and then clicking Add .
Once you've added all the qualifiers you want, click OK.