Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
If i try to set the background Color of a view with
SetBackgroundColor(0xffffffff), i get a compiler error as this is not a valid int value.
The same applies for new ColorDrawable(0xffffffff).
It works with SetBackgroundColor(-1) or new ColorDrawable(-1), but it is not the proper way to do so.
Setting the color to 0xffffff will create a transparent color as the alpha bits are not set.
Change parameter type from int to uint.
The recommended way of doing this is:
Thanks for the Info, this works. I see that the original method has the same structure.
I do have some remarks though:
- Color does have the same int constructor which has the same problems
- Adding a method like SetBackgroundColor(Color c) would make it a bit more obvious
- Help currently reads "Sets the background color for this view". Adding some hint to use Color would also be helpful :-)
Anyway, thanks for the quick help, much appreciated. You can close this ticket.