const int TabletCrossover = 600;
static bool? s_isLollipopOrNewer;
+ static bool? s_isMarshmallowOrNewer;
[Obsolete("Context is obsolete as of version 2.5. Please use a local context instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
}
}
+ internal static bool IsMarshmallowOrNewer
+ {
+ get
+ {
+ if (!s_isMarshmallowOrNewer.HasValue)
+ s_isMarshmallowOrNewer = (int)Build.VERSION.SdkInt >= 23;
+ return s_isMarshmallowOrNewer.Value;
+ }
+ }
+
public static Color GetColorButtonNormal(Context context)
{
if (!_ColorButtonNormalSet)
using System;
using System.ComponentModel;
using Android.Content;
+using Android.Support.V4.Content;
+using AColor = Android.Graphics.Color;
+using AColorRes = Android.Resource.Color;
using Android.Views;
namespace Xamarin.Forms.Platform.Android
bool isDefaultBkgndColor = bkgndColor.IsDefault;
if (page.Parent is BaseShellItem && isDefaultBkgndColor)
{
- var color = Context.Resources.GetColor(global::Android.Resource.Color.BackgroundLight, Context.Theme);
+ var color = Forms.IsMarshmallowOrNewer ?
+ Context.Resources.GetColor(AColorRes.BackgroundLight, Context.Theme) :
+ new AColor(ContextCompat.GetColor(Context, global::Android.Resource.Color.BackgroundLight));
SetBackgroundColor(color);
}
else if (!isDefaultBkgndColor || setBkndColorEvenWhenItsDefault)