Skip to content

Commit

Permalink
Guidelines: add more details and exceptions to compat drawable loading
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Dec 12, 2024
1 parent 1f5c4d6 commit 3120972
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ for example `ic_event_control_24dp.xml`.
Load vector drawables [using compat loading](https://medium.com/androiddevelopers/using-vector-assets-in-android-apps-4318fd662eb9)
so they work (tinting) and do not crash (gradients) on all supported releases:

- `Button`: use `ViewTools.setVectorDrawableTop`, ...
- `Button`: use `ViewTools.setVectorDrawableTop`, ... (uses `AppCompatResources.getDrawable()`)
- `ImageView`, `ImageButton`: use `app:srcCompat`
- `TextView`: use `app:drawableStartCompat`, `app:drawableTopCompat`, ...
- **Optionally** if the drawable is just a color
- **Not** for app widget layouts as the system initializes them

## Click listeners

Expand Down

0 comments on commit 3120972

Please sign in to comment.