diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2016-11-03 13:38:38 -0500 |
---|---|---|
committer | Samantha Houts <samantha@teamredwall.com> | 2016-11-03 11:38:38 -0700 |
commit | 84995a921221811d2e7047d54dcefde0c8063397 (patch) | |
tree | 5868bf9bd5ffd6dd2fb0c8d8b22fd8728b9c4764 /Xamarin.Forms.Platform.Android/CellAdapter.cs | |
parent | a2fae62d8384f78c1b5f0ba3dc088000946479bc (diff) | |
download | xamarin-forms-84995a921221811d2e7047d54dcefde0c8063397.tar.gz xamarin-forms-84995a921221811d2e7047d54dcefde0c8063397.tar.bz2 xamarin-forms-84995a921221811d2e7047d54dcefde0c8063397.zip |
[Android] Allow path-based icons to be loaded as toolbar icons (#437)
* Created a bitmap method to check for resource as well as path
* Update platform and navigationrenderer to get images from two locations
* CellAdapter could use path-based icon finding
* sample app to test toolbaritem icons
Diffstat (limited to 'Xamarin.Forms.Platform.Android/CellAdapter.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Android/CellAdapter.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Android/CellAdapter.cs b/Xamarin.Forms.Platform.Android/CellAdapter.cs index 44bcb3d9..02bf7a38 100644 --- a/Xamarin.Forms.Platform.Android/CellAdapter.cs +++ b/Xamarin.Forms.Platform.Android/CellAdapter.cs @@ -8,6 +8,7 @@ using Android.Views; using Android.Widget; using AView = Android.Views.View; using AListView = Android.Widget.ListView; +using Android.Graphics.Drawables; namespace Xamarin.Forms.Platform.Android { @@ -194,7 +195,11 @@ namespace Xamarin.Forms.Platform.Android IMenuItem item = menu.Add(Menu.None, i, Menu.None, action.Text); if (action.Icon != null) - item.SetIcon(_context.Resources.GetDrawable(action.Icon)); + { + 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)); + } action.PropertyChanged += changed; action.PropertyChanging += changing; |