Bug 42865 - android:windowDrawsSystemBarBackgrounds in styles.xml does not take effect
Summary: android:windowDrawsSystemBarBackgrounds in styles.xml does not take effect
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 6.1.0 (C7)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2016-07-28 03:33 UTC by 胡玮文
Modified: 2016-08-07 06:33 UTC (History)
2 users (show)

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


Attachments
repoduction (13.21 KB, application/x-zip-compressed)
2016-07-28 03:33 UTC, 胡玮文
Details
Android Studio Project (110.80 KB, application/x-zip-compressed)
2016-07-29 09:02 UTC, 胡玮文
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 ANSWERED

Description 胡玮文 2016-07-28 03:33:24 UTC
Created attachment 16805 [details]
repoduction

I add the following lines to my values-v21/styles.xml file.

<resources>
  <style name="AppTheme">
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">#FF0000</item>
  </style>
</resources>

the status bar remains black, but it is expected to be red.
If I add the following line to MainActivity.cs, the status bar turns red.

Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

I have tried the same style.xml file in Android Studio, and it works as expect.
So I guess android:windowDrawsSystemBarBackgrounds in xml file does not take effect as expect.
Comment 1 Al Clark [MSFT] 2016-07-28 14:10:30 UTC
Hi there! Would it be possible to include an Android Studio sample that exhibits the expected behaviour?

Also, your version information may be useful here:

Visual Studio
Help -> About Microsoft Visual Studio -> Copy Info [button]

Xamarin Studio in OS X
Xamarin Studio -> About Xamarin Studio -> Show Details -> Copy Information [button]
Comment 2 胡玮文 2016-07-29 09:02:18 UTC
Created attachment 16830 [details]
Android Studio Project

This is my Android Studio project.
Besides, you can uncomment the following line in MainActivity.cs to see the expected behavior.

Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

Here is my version information. I'm using the Chinese version of Visual Studio.

Microsoft Visual Studio Community 2015
版本 14.0.25424.00 Update 3
Microsoft .NET Framework
版本 4.6.01038

已安装的版本: Community

Microsoft Visual Studio Tools for Applications 2015   00322-20000-00000-AA309
Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015   00322-20000-00000-AA309
Microsoft Visual Basic 2015

Visual C# 2015   00322-20000-00000-AA309
Microsoft Visual C# 2015

Visual C++ 2015   00322-20000-00000-AA309
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - CHS   00322-20000-00000-AA309
Windows Phone SDK 8.0 - CHS

Application Insights Tools for Visual Studio 包   7.1.00719.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1   14.1.20624.0
ASP.NET and Web Tools 2015.1

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

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

Azure App Service Tools v2.8.1   14.0.11123.0
Azure App Service Tools v2.8.1

JavaScript 项目系统   2.0
JavaScript 项目系统

JavaScript 语言服务   2.0
JavaScript 语言服务

Microsoft .NET Core Tools (Preview 2)   14.1.20624.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure 移动服务工具   1.4
Microsoft Azure 移动服务工具

NuGet 包管理器   3.5.0
Visual Studio 中的 NuGet 包管理器。有关 NuGet 的详细信息,请访问 http://docs.nuget.org/。

PreEmptive Analytics 可视化工具   1.2
Microsoft Visual Studio 扩展可以可视化 PreEmptive Analytics 产品的聚合摘要。

SQL Server Analysis Services   13.0.1605.88
Microsoft SQL Server Analysis Services Designer 
Version 13.0.1605.88

SQL Server Data Tools   14.0.60629.0
Microsoft SQL Server Data Tools

SQL Server Integration Services   
Microsoft SQL Server Integration Services Designer
Version 13.0.1601.5

SQL Server Reporting Services   13.0.1605.88
Microsoft SQL Server Reporting Services Designers 
Version 13.0.1605.88

TypeScript   1.8.35.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25420.01
Visual Studio Tools for Universal Windows Apps 让你能够构建一种通用的应用体验,运行 Windows 10 的每种设备都可以获得这种体验,如手机、平板电脑、PC 等。它包含 Microsoft Windows 10 软件开发工具包。

Xamarin   4.1.1.3 (34a92cd)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.1.1.1 (7db2aac)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   9.8.1.4 (3cf8aae)
Visual Studio extension to enable development for Xamarin.iOS.

通用 Azure 工具   1.8
通过 Azure 移动服务和 Microsoft Azure Tools 提供通用服务。
Comment 3 Al Clark [MSFT] 2016-08-04 17:08:57 UTC
It looks like you're not declaring your target SDK in your Xamarin project.  After setting that in the AndroidManifect.xml you should see the expected behaviour.

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
Comment 4 胡玮文 2016-08-07 06:33:12 UTC
Yes, that's right. I'm sorry.

But There is another problem.
If I delete the android:targetSdkVersion attribute from AndroidManifect.xml, "Target Android version" will automatically turn to "Use Compile using SDK version". it's misleading. In fact, the default value of android:targetSdkVersion is minSdkVersion.

see https://developer.android.com/guide/topics/manifest/uses-sdk-element.html