diff options
author | Jimmy Garrido <jimmygarrido@outlook.com> | 2017-03-03 04:24:43 -0800 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-03-03 12:24:43 +0000 |
commit | 5d4fdd5e748e1d3f5a7e17d5e2680c5d520cc620 (patch) | |
tree | 91071ecc7420f4792b4c4e6b052a96df833329c4 /Xamarin.Forms.Platform.Android | |
parent | 97b28b1c20746bec32d8a1cd26f1c5d268d11680 (diff) | |
download | xamarin-forms-5d4fdd5e748e1d3f5a7e17d5e2680c5d520cc620.tar.gz xamarin-forms-5d4fdd5e748e1d3f5a7e17d5e2680c5d520cc620.tar.bz2 xamarin-forms-5d4fdd5e748e1d3f5a7e17d5e2680c5d520cc620.zip |
[Android] Fix NavigationPage.BarTextColorProperty on API 21+ with FormsApplicationActivity (#631)
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Platform.cs | 18 |
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()); |