Bug 22237 - BarBackgroundColor on Android lost
Summary: BarBackgroundColor on Android lost
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-20 15:20 UTC by Michel Chowanski
Modified: 2016-03-16 12:24 UTC (History)
11 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
The app at the beginning (23.61 KB, image/jpeg)
2014-08-20 15:20 UTC, Michel Chowanski
Details
After clicking at one item (19.95 KB, image/jpeg)
2014-08-20 15:21 UTC, Michel Chowanski
Details
Example Project (6.69 MB, application/x-zip-compressed)
2014-08-20 15:28 UTC, Michel Chowanski
Details
Pic of running device (187.25 KB, application/octet-stream)
2014-08-26 09:56 UTC, Rajneesh Kumar
Details
Second Project without NavigationPage (6.59 MB, application/x-zip-compressed)
2014-08-28 15:11 UTC, Michel Chowanski
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Michel Chowanski 2014-08-20 15:20:44 UTC
Created attachment 7742 [details]
The app at the beginning

I use a Master Detail Page within a NavigationPage and set the property BarBackgroundColor on Dark Green.
After clicking on one of the master items, I want to create a new DetailPage.

Example:
            NamedColorPage detailPage = new NamedColorPage(true);
            
            this.Detail = detailPage;

            // Define a selected handler for the ListView.
            listView.ItemSelected += (sender, args) =>
            {
                NamedColorPage detailPage2 = new NamedColorPage(true);
                this.Detail = detailPage2;

                // Show the detail page.
                this.IsPresented = false;
            };

But after setting "this.Detail = detailPage2", the BarBackgroundColor change to black. In the appendix you will find a picture of the app lat the beginning (with dark green ActionBar, "FirstPage.jpg") and after I clicked on an item (with black ActionBar, "SecondPage.jpg").

And I have appended a sample project. Do you need more infos?
Comment 1 Michel Chowanski 2014-08-20 15:21:15 UTC
Created attachment 7743 [details]
After clicking at one item
Comment 2 Michel Chowanski 2014-08-20 15:28:08 UTC
Created attachment 7744 [details]
Example Project
Comment 3 Rajneesh Kumar 2014-08-26 09:48:17 UTC
I have checked this issue and not able to reproduce. I try to reproduce this issue with the attached sample project. But the project is working as described in bug description. I have checked it on emulator and device both, and getting the same working behavior.

Note: I have used Nexus 7 to check this issue.

Could you please provide us, your environment info, device information? That will be helpful to reproduce this issue at our end. If possible, please check this application with another device, and tell us what is going on.

Let me know if I am missing something.

Screencast: http://www.screencast.com/t/H4XsCzzGIMYg

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0444002-02685
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0444002-02685
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0444002-02685
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0444002-02685
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0444002-02685
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0444002-02685
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02685
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0444002-02685
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.20703.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50313.46
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.3.47.0 (0b2a123923812a88ed3091909478dbe9e0111f00)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 4 Rajneesh Kumar 2014-08-26 09:56:42 UTC
Created attachment 7799 [details]
Pic of running device
Comment 5 Michel Chowanski 2014-08-27 12:48:05 UTC
Thanks for checking ;-)

I tried to reproduce this with Google Emulators - unfortunately without success. I can reproduce the error only on my device (a Samsung Galaxy S3 mini). I dont't have any other devices for tests.
How can I help you find the error? More info? A screencast?



--------------------------------------------
Environment Info:
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Team Explorer for Visual Studio 2013   06177-004-0446034-02600
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0446034-02600
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0446034-02600
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0446034-02600
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0446034-02600
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0446034-02600
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0446034-02600
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

Common Azure Tools   1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Git Source Control Provider   1.0.0.0


Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50313.46
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PowerShell Tools   1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SAPReferenceManager   1.0
Manages References to Shared Projects

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Xamarin   3.3.47.0 (0b2a123923812a88ed3091909478dbe9e0111f00)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 6 Michel Chowanski 2014-08-28 15:11:07 UTC
Created attachment 7859 [details]
Second Project without NavigationPage

Here a second project. This time only the MasterDetailPage without NavigationPage. I set the TabBackGroundColor with a custom theme in the Android MainActivity. First Page looks good - after clickung at one item the TabBarBackGroundColor will be black.
Comment 7 Michel Chowanski 2014-08-28 15:14:22 UTC
And also the title won't change (@ second project). I've set

   this.Title = "Test";

in the project (at MasterDetailPage). But it will be ignored.
Comment 8 Michel Chowanski 2014-08-28 15:32:57 UTC
Here a short video. I start the second project on my samsung galasy s3 mini. At first, you will see the yellow bar (I changed it from dark green to yellow for the video). After clicking at one item - it will changed to black.

http://www.screencast.com/t/Q5nxrauXlxVI

Android Version: 4.2.2

Does it help?
Comment 9 Michel Chowanski 2014-08-28 16:01:21 UTC
And if I want to start a new MasterDetailPage "MasterDetail2" from the current MasterDetailPage, the barbackgroundcolor will be lost at "MasterDetail2" again:

                var MasterDetailPage = new MasterDetail2());
                this.Navigation.PushModalAsync(MasterDetailPage );
Comment 10 Rajneesh Kumar 2014-08-29 02:25:39 UTC
I have checked this issue and able to reproduce on samsung galaxy s3 mini. 

Steps to reproduce:

1. Open attached sample project in VS provided in comment 6.
2. Build the project and deploy it on samsung galaxy s3 mini.
3. Application will deploy successfully you will see yellow bar with title "NavigationMasterPage" 
4. Click on "<" second screen is appear "MasterDetailPage"
5.  Now click on any item to go to another screen
6.  Examine that yellow color title bar of  "NavigationMasterPage"  changed to Black

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0444002-02685
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0444002-02685
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0444002-02685
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0444002-02685
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0444002-02685
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0444002-02685
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02685
MicrosoftÆ Visual StudioÆ 2013 Code Analysis Spell Checker

Portions of International CorrectSpellô spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American HeritageÆ Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0444002-02685
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.20703.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50313.46
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.3.47.0 (0b2a123923812a88ed3091909478dbe9e0111f00)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 11 Rajneesh Kumar 2014-08-29 02:30:27 UTC
An update to comment 10 :

Device info on which issue gets reproduced:

Samsung galaxy s3 mini
Android Version 4.1.2
Kernel version 3.0.31-846552
Comment 12 Michel Chowanski 2014-09-10 16:17:08 UTC
Update: When I add a ToolbarItem to each page, the bug will be fixed. Maybe it will help to fix it generally ...
Comment 13 Tibor Ebner 2015-02-03 07:52:19 UTC
We are suffering from this bug since more than 6 months. It would be nice to have this fixed for good.
Comment 14 Jason Smith [MSFT] 2015-02-10 02:00:05 UTC
Okay this bug report has devolved a bit, Im trying to hash it out...

First @Michel Chowanski

this code: 

And if I want to start a new MasterDetailPage "MasterDetail2" from the current
MasterDetailPage, the barbackgroundcolor will be lost at "MasterDetail2" again:

                var MasterDetailPage = new MasterDetail2());
                this.Navigation.PushModalAsync(MasterDetailPage );

is going to result in a black bar because you performed a modal push. This is expected. Every time you perform a modal push you will essentially reset the state of the ActionBar to track the modals and not the previous roots.

We are unable to reproduce the issue you are having with the actionbar color. It looks like you are attempting to set it with a theme, this should work, we grab the background drawable for the action bar using the following code:

Drawable GetActionBarBackgroundDrawable ()
{
	int[] backgroundDataArray = {Resource.Attribute.Background};

	using (var outVal = new TypedValue ()) {
		context.Theme.ResolveAttribute (Resource.Attribute.ActionBarStyle, outVal, true);
		var actionBarStyle = context.Theme.ObtainStyledAttributes (outVal.ResourceId, backgroundDataArray);

		var result = actionBarStyle.GetDrawable (0);
		actionBarStyle.Recycle ();
		return result;
	}
}

This code should respect your theme, however it sounds like you might be having an issue with a specific device, namely the Galaxy SIII. These devices use the touchwiz interface. I will check if I can reproduce the issue there.
Comment 15 Jason Smith [MSFT] 2016-03-16 12:24:12 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we no longer believe it affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team