android-custom-icons
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAndroid Custom PNG Icons
Android自定义PNG图标
Use custom PNG icons in Android apps instead of icon libraries. Whenever UI code includes an icon, the agent must use a PNG placeholder and update so the icon list is tracked for later upload.
PROJECT_ICONS.md在Android应用中使用自定义PNG图标而非图标库。每当UI代码中包含图标时,必须使用PNG占位符并更新,以便后续上传时跟踪图标列表。
PROJECT_ICONS.mdScope
适用范围
Use for: All Android UI generation (Compose and XML).
Do not use: Material Icons, Font Awesome, or any bundled icon libraries unless the user explicitly asks for them.
适用场景: 所有Android UI生成(Compose和XML)。
禁止使用: Material Icons、Font Awesome或任何捆绑图标库,除非用户明确要求。
Standard Icon Directory
标准图标目录
- Primary location:
app/src/main/res/drawable/ - If you need 1:1 pixels (no scaling):
app/src/main/res/drawable-nodpi/
If multiple densities are provided later, place them in,drawable-hdpi,drawable-xhdpi,drawable-xxhdpiusing the same file name.drawable-xxxhdpi
- 主位置:
app/src/main/res/drawable/ - 如果需要1:1像素(不缩放):
app/src/main/res/drawable-nodpi/
如果后续提供多种密度的图标,请将它们放在、drawable-hdpi、drawable-xhdpi、drawable-xxhdpi目录下,使用相同的文件名。drawable-xxxhdpi
File Naming Rules (Required)
文件命名规则(必填)
- Lowercase letters, numbers, underscores only
- No hyphens, no spaces, no uppercase
- File name becomes
R.drawable.<name>
Examples:
- ->
cancel.pngR.drawable.cancel - ->
chart.pngR.drawable.chart - ->
filter.pngR.drawable.filter
- 仅使用小写字母、数字、下划线
- 不得使用连字符、空格、大写字母
- 文件名对应
R.drawable.<name>
示例:
- ->
cancel.pngR.drawable.cancel - ->
chart.pngR.drawable.chart - ->
filter.pngR.drawable.filter
Compose Usage (Required)
Compose使用规范(必填)
kotlin
Icon(
painter = painterResource(R.drawable.cancel),
contentDescription = "Cancel",
modifier = Modifier.size(24.dp)
)kotlin
Image(
painter = painterResource(R.drawable.chart),
contentDescription = null,
modifier = Modifier.size(48.dp)
)kotlin
Icon(
painter = painterResource(R.drawable.cancel),
contentDescription = "Cancel",
modifier = Modifier.size(24.dp)
)kotlin
Image(
painter = painterResource(R.drawable.chart),
contentDescription = null,
modifier = Modifier.size(48.dp)
)XML Usage (Required)
XML使用规范(必填)
xml
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/cancel"
android:contentDescription="@string/cancel" />xml
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/cancel"
android:contentDescription="@string/cancel" />PROJECT_ICONS.md (Required)
PROJECT_ICONS.md(必填)
Maintain a file at the project root. Every time code introduces a new icon placeholder, append a row.
PROJECT_ICONS.md在项目根目录维护一个文件。每当代码中引入新的图标占位符时,添加一行记录。
PROJECT_ICONS.mdTemplate
模板
markdown
undefinedmarkdown
undefinedProject Icons
Project Icons
Standard path: app/src/main/res/drawable/
| Icon File | Usage | Screen/Component | Status | Notes |
|---|---|---|---|---|
| cancel.png | Close action | EditProfileTopBar | placeholder | Provide 24dp PNG |
undefinedStandard path: app/src/main/res/drawable/
| Icon File | Usage | Screen/Component | Status | Notes |
|---|---|---|---|---|
| cancel.png | Close action | EditProfileTopBar | placeholder | Provide 24dp PNG |
undefinedUpdate Rules
更新规则
- Add a row every time a new icon placeholder is referenced in code.
- Use the exact file name used in code (e.g., ).
cancel.png - Keep status as until the PNG is provided.
placeholder
- 每当代码中引用新的图标占位符时,添加一行记录。
- 使用代码中确切的文件名(例如)。
cancel.png - 在PNG图标提供前,状态保持为。
placeholder
Mandatory Checklist (Per UI Generation)
强制检查清单(每次UI生成时)
- Use PNG placeholders only (no icon libraries)
- Use or
painterResource(R.drawable.<name>)@drawable/<name> - Add or update
PROJECT_ICONS.md - Placeholders use valid Android resource naming
- 仅使用PNG占位符(不使用图标库)
- 使用或
painterResource(R.drawable.<name>)@drawable/<name> - 添加或更新
PROJECT_ICONS.md - 占位符使用有效的Android资源命名规则