diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize.xml b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize.xml
new file mode 100644
index 000000000..d5de57bdb
--- /dev/null
+++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize_disabled.xml b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize_disabled.xml
new file mode 100644
index 000000000..866845bdd
--- /dev/null
+++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize_disabled.xml
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize_enabled.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize_enabled.png
new file mode 100644
index 000000000..339cab59e
Binary files /dev/null and b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/synchronize_enabled.png differ
diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
index c8b9f6eb9..75a5a7b83 100644
--- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
+++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
@@ -274,6 +274,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53909.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53909.cs
new file mode 100644
index 000000000..a02de5b39
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53909.cs
@@ -0,0 +1,38 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+// Apply the default category of "Issues" to all of the tests in this assembly
+// We use this as a catch-all for tests which haven't been individually categorized
+#if UITEST
+[assembly: NUnit.Framework.Category("Issues")]
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 53909, "XML drawables cannot be used as ToolbarItem.Icon ", PlatformAffected.Default)]
+ public class Bugzilla53909 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init()
+ {
+
+ var tbi = new ToolbarItem();
+ tbi.Icon = "synchronize.png";
+ tbi.Order = ToolbarItemOrder.Primary;
+ tbi.Priority = 0;
+
+ ToolbarItems.Add(tbi);
+
+ // Initialize ui here instead of ctor
+ Content = new Label
+ {
+ Text = "We need to check the icon appears"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 6a621e4f2..bf393aec1 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -268,6 +268,7 @@
+
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
index cc4742937..1b4afba2e 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
@@ -744,8 +744,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
FileImageSource icon = item.Icon;
if (!string.IsNullOrEmpty(icon))
{
- var iconBitmap = new BitmapDrawable(context.Resources, ResourceManager.GetBitmap(context.Resources, icon));
- if (iconBitmap != null && iconBitmap.Bitmap != null)
+ Drawable iconBitmap = context.Resources.GetDrawable(icon) ?? new BitmapDrawable(context.Resources, ResourceManager.GetBitmap(context.Resources, icon));
+ if (iconBitmap != null)
menuItem.SetIcon(iconBitmap);
}
menuItem.SetEnabled(controller.IsEnabled);
diff --git a/Xamarin.Forms.Platform.Android/CellAdapter.cs b/Xamarin.Forms.Platform.Android/CellAdapter.cs
index dda0c7e10..187ac23cb 100644
--- a/Xamarin.Forms.Platform.Android/CellAdapter.cs
+++ b/Xamarin.Forms.Platform.Android/CellAdapter.cs
@@ -195,9 +195,9 @@ namespace Xamarin.Forms.Platform.Android
if (action.Icon != null)
{
- var iconBitmap = new BitmapDrawable(_context.Resources, ResourceManager.GetBitmap(_context.Resources, action.Icon));
- if (iconBitmap != null && iconBitmap.Bitmap != null)
- item.SetIcon(_context.Resources.GetDrawable(action.Icon));
+ Drawable iconBitmap = _context.Resources.GetDrawable(action.Icon) ?? new BitmapDrawable(_context.Resources, ResourceManager.GetBitmap(_context.Resources, action.Icon));
+ if (iconBitmap != null)
+ item.SetIcon(iconBitmap);
}
action.PropertyChanged += changed;
diff --git a/Xamarin.Forms.Platform.Android/Platform.cs b/Xamarin.Forms.Platform.Android/Platform.cs
index 0fc287c9c..c2bb007e0 100644
--- a/Xamarin.Forms.Platform.Android/Platform.cs
+++ b/Xamarin.Forms.Platform.Android/Platform.cs
@@ -359,10 +359,11 @@ namespace Xamarin.Forms.Platform.Android
else
{
IMenuItem menuItem = menu.Add(item.Text);
- if (!string.IsNullOrEmpty(item.Icon))
+ var icon = item.Icon;
+ if (!string.IsNullOrEmpty(icon))
{
- var iconBitmap = new BitmapDrawable(_context.Resources, ResourceManager.GetBitmap(_context.Resources, item.Icon));
- if (iconBitmap != null && iconBitmap.Bitmap != null)
+ Drawable iconBitmap = _context.Resources.GetDrawable(icon) ?? new BitmapDrawable(_context.Resources, ResourceManager.GetBitmap(_context.Resources, icon));
+ if (iconBitmap != null)
menuItem.SetIcon(iconBitmap);
}
menuItem.SetEnabled(controller.IsEnabled);