Ringkasan jenis resource
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Setiap halaman di bagian ini menjelaskan penggunaan, format, dan sintaksis untuk jenis
resource aplikasi tertentu
yang dapat Anda berikan dalam direktori resource project Anda (res/
).
Berikut ringkasan singkat masing-masing halamannya:
- Resource animasi
- Menentukan animasi yang telah ditetapkan.
Animasi hitung nilai disimpan di res/anim/
dan diakses dari class R.anim
.
Animasi bingkai disimpan di res/drawable/
dan diakses dari class R.drawable
.
- Resource daftar status warna
- Menentukan resource warna yang berubah berdasarkan status
View
.
Disimpan di res/color/
dan diakses dari class R.color
.
- Resource drawable
- Menentukan berbagai grafis dengan bitmap atau XML.
Disimpan di res/drawable/
dan diakses dari class R.drawable
.
- Resource tata letak
- Menentukan tata letak untuk UI aplikasi Anda.
Disimpan di res/layout/
dan diakses dari class R.layout
.
- Resource menu
- Menentukan isi menu aplikasi Anda.
Disimpan di res/menu/
dan diakses dari class R.menu
.
- Resource string
- Menentukan string, array string, dan bentuk jamak serta menyertakan pemformatan dan gaya string.
Disimpan di res/values/
dan diakses dari class R.string
, R.array
,
dan R.plurals
.
- Resource gaya
- Menentukan tampilan dan format elemen UI.
Disimpan di res/values/
dan diakses dari class R.style
.
- Resource font
- Menentukan jenis font dan menyertakan font kustom dalam XML.
Disimpan di res/font/
dan diakses dari class R.font
.
- Jenis resource lainnya
- Menentukan nilai dasar lainnya sebagai resource statis, termasuk:
- Bool
- Resource XML yang berisi nilai boolean.
- Warna
- Resource XML yang berisi nilai warna heksadesimal.
- Dimensi
- Resource XML yang berisi nilai dimensi dengan unit ukuran.
- ID
- Resource XML yang memberikan ID unik untuk resource dan komponen
aplikasi.
- Bilangan Bulat
- Resource XML yang berisi nilai bilangan bulat.
- Array bilangan bulat
- Resource XML yang menyediakan array bilangan bulat.
- Array yang memiliki jenis
- Resource XML yang menyediakan
TypedArray
, yang dapat Anda gunakan
untuk array drawable.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[null,null,["Terakhir diperbarui pada 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."]]