リソースタイプの概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このセクションの各ページでは、プロジェクト リソース ディレクトリ(res/
)で提供できる特定タイプのアプリリソースの使用法、形式、構文について紹介します。
各ページの概要は次のとおりです。
- アニメーション リソース
- 事前定義のアニメーションを定義します。
トゥイーン アニメーションは res/anim/
に保存し、R.anim
クラスからアクセスします。
フレーム アニメーションは res/drawable/
に保存し、R.drawable
クラスからアクセスします。
- 色状態リストのリソース
View
の状態に応じて変わるカラーリソースを定義します。
res/color/
に保存し、R.color
クラスからアクセスします。
- ドローアブル リソース
- ビットマップや XML でさまざまなグラフィックを定義します。
res/drawable/
に保存し、R.drawable
クラスからアクセスします。
- レイアウト リソース
- アプリ UI のレイアウトを定義します。
res/layout/
に保存し、R.layout
クラスからアクセスします。
- メニュー リソース
- アプリメニューの内容を定義します。
res/menu/
に保存し、R.menu
クラスからアクセスします。
- 文字列リソース
- 文字列、文字列配列、複数形を定義し、文字列の書式設定とスタイル設定も含めます。
res/values/
に保存し、R.string
クラス、R.array
クラス、R.plurals
クラスからアクセスします。
- スタイル リソース
- UI 要素の外観と形式を定義します。
res/values/
に保存し、R.style
クラスからアクセスします。
- フォント リソース
- フォント ファミリーを定義し、カスタム フォントを XML に含めます。
res/font/
に保存し、R.font
クラスからアクセスします。
- その他のリソースタイプ
- 以下をはじめとする基本的な値を静的リソースとして定義します。
- ブール値
- ブール値を保有する XML リソース。
- 色
- 16 進数の色の値を保有する XML リソース。
- ディメンション
- 測定単位付きのディメンションの値を保有する XML リソース。
- ID
- アプリリソースとコンポーネントの一意の識別子を提供する XML リソース。
- 整数
- 整数値を保有する XML リソース。
- 整数配列
- 整数の配列を提供する XML リソース。
- 型付き配列
TypedArray
を提供する XML リソース(ドローアブルの配列に使用できます)。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# Resource types overview\n\nEach page in this section describes the usage, format, and syntax for a certain type\nof [app resource](/guide/topics/resources/providing-resources)\nthat you can provide in your project resources directory (`res/`).\n\nHere's a brief summary of each page:\n\n[Animation resources](/guide/topics/resources/animation-resource)\n: Define pre-determined animations. \n\n Tween animations are saved in `res/anim/` and accessed from the `R.anim` class. \n\n Frame animations are saved in `res/drawable/` and accessed from the `R.drawable` class.\n\n[Color state list resource](/guide/topics/resources/color-list-resource)\n: Define a color resource that changes based on the `View` state. \n\n Saved in `res/color/` and accessed from the `R.color` class.\n\n[Drawable resources](/guide/topics/resources/drawable-resource)\n: Define various graphics with bitmaps or XML. \n\n Saved in `res/drawable/` and accessed from the `R.drawable` class.\n\n[Layout resource](/guide/topics/resources/layout-resource)\n: Define the layout for your application UI. \n\n Saved in `res/layout/` and accessed from the `R.layout` class.\n\n[Menu resource](/guide/topics/resources/menu-resource)\n: Define the contents of your application menus. \n\n Saved in `res/menu/` and accessed from the `R.menu` class.\n\n[String resources](/guide/topics/resources/string-resource)\n: Define strings, string arrays, and plurals and include string formatting and styling. \n\n Saved in `res/values/` and accessed from the `R.string`, `R.array`,\n and `R.plurals` classes.\n\n[Style resource](/guide/topics/resources/style-resource)\n: Define the look and format for UI elements. \n\n Saved in `res/values/` and accessed from the `R.style` class.\n\n[Font resources](/guide/topics/resources/font-resource)\n: Define font families and include custom fonts in XML. \n\n Saved in `res/font/` and accessed from the `R.font` class.\n\n[More resource types](/guide/topics/resources/more-resources)\n: Define other primitive values as static resources, including the following:\n\n [Bool](/guide/topics/resources/more-resources#Bool)\n : XML resource that carries a boolean value.\n\n [Color](/guide/topics/resources/more-resources#Color)\n : XML resource that carries a hexadecimal color value.\n\n [Dimension](/guide/topics/resources/more-resources#Dimension)\n : XML resource that carries a dimension value with a unit of measure.\n\n [ID](/guide/topics/resources/more-resources#Id)\n : XML resource that provides a unique identifier for application resources and\n components.\n\n [Integer](/guide/topics/resources/more-resources#Integer)\n : XML resource that carries an integer value.\n\n [Integer array](/guide/topics/resources/more-resources#IntegerArray)\n : XML resource that provides an array of integers.\n\n [Typed array](/guide/topics/resources/more-resources#TypedArray)\n : XML resource that provides a [TypedArray](/reference/android/content/res/TypedArray), which you can use\n for an array of drawables."]]