Skip to content

Add Android adaptive icon support#115

Merged
andydotxyz merged 8 commits intofyne-io:mainfrom
andydotxyz:fix/adaptiveicon
Feb 16, 2026
Merged

Add Android adaptive icon support#115
andydotxyz merged 8 commits intofyne-io:mainfrom
andydotxyz:fix/adaptiveicon

Conversation

@andydotxyz
Copy link
Copy Markdown
Member

@andydotxyz andydotxyz commented Feb 10, 2026

This is an optional extra, if present you need to have a more recent Android SDK to compile (but still 9 years old ;) ).

Create files icon-foreground.png, Icon-background.png (optional) and Icon-monospace.png (optional) to get picked up automatically. Or you can use the new [AdaptiveIcon] section with Foreground, Background and Monospace.

Fixes fyne-io/fyne#1270

Future work (other PRs, later)

  • Generate adaptive icon FG / BG from the legacy Icon file (scale content down, create background colour)
  • Remove legacy icon path and strip out all the binres code that won't be needed with aapt2 doing the heavy lifting.

@andydotxyz
Copy link
Copy Markdown
Member Author

You can see usage at andydotxyz/fynepet@695c81a

@andydotxyz
Copy link
Copy Markdown
Member Author

Showing the impact:

shot2

}

// If monochrome provided, create v33 resources with monochrome support
if hasMonochrome {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: inverting the check would allow to return nil early and have less indented code after.

defer r.Close()

for _, f := range r.File {
if f.Name == fileName {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar minor nit, inverting the check could lead to less nested code.

monochrome = filepath.Join(dir, "Icon-monochrome.png")
}

if util.Exists(foreground) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same minor nit pick again.

Copy link
Copy Markdown
Contributor

@sdassow sdassow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@andydotxyz
Copy link
Copy Markdown
Member Author

Good nits @sdassow - updated

@andydotxyz andydotxyz merged commit 441e8cd into fyne-io:main Feb 16, 2026
7 checks passed
@andydotxyz andydotxyz deleted the fix/adaptiveicon branch February 16, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Android Adaptive Icons in Fyne package

2 participants