summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Platform.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Platform.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/Platform.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.Android/Platform.cs b/Xamarin.Forms.Platform.Android/Platform.cs
index 29af59f7..ca0b9708 100644
--- a/Xamarin.Forms.Platform.Android/Platform.cs
+++ b/Xamarin.Forms.Platform.Android/Platform.cs
@@ -846,9 +846,21 @@ namespace Xamarin.Forms.Platform.Android
Color navigationBarTextColor = CurrentNavigationPage == null ? Color.Default : CurrentNavigationPage.BarTextColor;
TextView actionBarTitleTextView = null;
- int actionBarTitleId = _context.Resources.GetIdentifier("action_bar_title", "id", "android");
- if (actionBarTitleId > 0)
- actionBarTitleTextView = ((Activity)_context).FindViewById<TextView>(actionBarTitleId);
+ if(Forms.IsLollipopOrNewer)
+ {
+ int actionbarId = _context.Resources.GetIdentifier("action_bar", "id", "android");
+ if(actionbarId > 0)
+ {
+ var toolbar = (Toolbar)((Activity)_context).FindViewById(actionbarId);
+ actionBarTitleTextView = (TextView)toolbar.GetChildAt(0);
+ }
+ }
+ else
+ {
+ int actionBarTitleId = _context.Resources.GetIdentifier("action_bar_title", "id", "android");
+ if (actionBarTitleId > 0)
+ actionBarTitleTextView = ((Activity)_context).FindViewById<TextView>(actionBarTitleId);
+ }
if (actionBarTitleTextView != null && navigationBarTextColor != Color.Default)
actionBarTitleTextView.SetTextColor(navigationBarTextColor.ToAndroid());