https://github.com/g3th/drawable-comparison
Comparing two drawable resources inside an ImageView by tag.
https://github.com/g3th/drawable-comparison
android app-development databinding drawable imageview kotlin viewbinding
Last synced: 4 months ago
JSON representation
Comparing two drawable resources inside an ImageView by tag.
- Host: GitHub
- URL: https://github.com/g3th/drawable-comparison
- Owner: g3th
- Created: 2023-11-24T01:51:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-24T02:04:06.000Z (over 2 years ago)
- Last Synced: 2025-01-15T10:27:13.329Z (about 1 year ago)
- Topics: android, app-development, databinding, drawable, imageview, kotlin, viewbinding
- Language: Kotlin
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Drawable Comparison
## Comparing Drawables in Android By Tags
For some app development or in particular projects, a comparison between drawables inside an ImageView or similar View might be needed. Such a case might be a drag-and-drop operation which needs to match two images for a game. Another case, might look if an ImageView contains a blank/placeholder image, and replace it with an image of choice in specific cases.
The easiest method I have found personally is tag usage. Swapping tags, and comparing them will be much easier than using something like:
``` binding.image.drawable.constantState```
or
```binding.image.drawable.toBitmap()```
and similar methods. I have not had much success with the above, and found the most effective method was the one mentioned.