How to set UIDatePicker background color to white in xamarin.ios for ios 14? - xamarin.ios

I am hiding a label by a UIDatePicker in a xamarin.ios app. I changed the style of the datepicker label but can't change the background to white. Here is my code:
datePickerDateFrom.Frame = lblFromDate.Frame;
datePickerDateFrom.Subviews[0].Subviews[0].SetValueForKey(UIColor.White, new NSString("backgroundColor"));
datePickerDateFrom.Subviews[0].Subviews[0].TintColor = UIColor.Black;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderWidth = 1;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.CornerRadius = 6;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderColor = UIColor.FromRGB(0, 184, 212).CGColor;
datePickerDateFrom.SizeToFit();
Add(datePickerDateFrom);
And the result is:
Any other color works but if I set the color to white it remains this ash color that's why sometimes there is a color difference inside the blue border when the short date format is selected. I don't know is it possible to align the value inside the frame and specify any fixed date format(as sometimes it displays 3 letter of month name when gets larger space). For now changing the background color to white would be a great help. Thanks in advance.

Related

Background color for segmented control in IOS

I have a segmented control which needs to be blue when selected, and white when unselected. Im facing problems to set the tint color when unselected, as for some reason, it always turns out to be grey.
This is what it looks like:
The blue border is actually a UIView with some border color, and within it I stuck the segmented control. But I cant change the grey background ( which should be white ).
I tried doing all of this :
sc.selectedSegmentTintColor = UIColor.blue
sc.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .body),NSAttributedString.Key.foregroundColor: UIColor.white], for: .selected)
sc.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .body),NSAttributedString.Key.foregroundColor: UIColor.blue], for: .normal)
sc.tintColor = .white
sc.backgroundColor = .white
sc.isOpaque = true
with no success. :(
It's working fine with background color
self.backgroundColor = .red
It's working fine in iOS 13

How to identify colour of an icon of presence

I am new to espresso .My test scenario involves to check the colour of the icon during the presence.For example if person X in available there is small green icon next to his name, if he is busy icon change to red
I am not quit sure how I can test colour of the specific icon R.id.presence
I do understand I need to use drawable but not sure how
You can try something like this. Try to find the element(probably R.id.presence in your case) and then try to get the background color of the element. Now compare it with the expected color.
Sample code for a button where green as background color is being verified.
Button btn = (Button) findViewById(R.id.my_button);
Drawable buttonBackground = btn.getBackground();
ColorDrawable btn_color = (ColorDrawable) btn.getBackground();
int color = btn_color.getColor();
if (color == R.color.green) {
log("color is green");
}
Hope it helps :)

Blue color table border using docx4j

I'm using docx4j to create a docx file. I want my table border to be blue colored but it is only showing black.how to do this?
Here is my code:
table.setTblPr(new TblPr());
CTBorder border = new CTBorder();
border.setColor("FFF");
border.setSz(new BigInteger("0"));
border.setSpace(new BigInteger("0"));
border.setVal(STBorder.SINGLE);
TblBorders borders = new TblBorders();
borders.setBottom(border);
borders.setLeft(border);
borders.setRight(border);
borders.setTop(border);
borders.setInsideH(border);
borders.setInsideV(border);
table.getTblPr().setTblBorders(borders);
You need to set the color attribute of the border in question. Your example code appears to have you setting a colour of 'FFF' which obviously won't work if it needs to be blue! I would suggest trying a straight blue in hex and going from there. For example a (very) standard blue would be:
CTBorder border = new CTBorder();
border.setColor("0000FF");

Rounded corner when change LoadMoreElement background color in Monotouch Dialog

I'm trying using this code :
LoadMoreElement elm = new LoadMoreElement (normalCaption, loadingCaption, tapped);
elm.BackgroundColor = UIColor.Blue; // new UIColor (27,109,192,1);
elm.TextColor = UIColor.White;
This results in a complete blue rectangular cell with no rounded corners.
What I'm missing?
The LoadMoreElement is only intended to be used in the middle of the table, not on the corners.
If you want to use it, you will need to write custom code to render the corners, you can see some sample code in the ImageElements.

How to change the flash color?

I want to change the flash color when using element.flash method. By default its yellow.
I was able to increase the number of flash times and delay time in elements.rb file. But i dont know how to change the highlight color.
Any idea on this?
Using different colors to highlight will be helpful if browser elements have yellow background.
Solution
The flashing is based on the element's container's activeObjectHighLightColor. This is set by doing:
element.container.activeObjectHighLightColor = "colour"
Where colour is a valid web-friendly color (as per the container.rb file).
Example - Flash For Individual Element
As an example, here is changing the flash colour for the text field on the Google search:
#Use google search text field as a test page
ie = Watir::Browser.new
ie.goto 'www.google.ca'
e = ie.text_field(:name => 'q')
#Set the flash colour
e.container.activeObjectHighLightColor = "green"
#Flash the object, which should now be green
e.flash
Note:
This will only work with Watir-classic. Watir-webdriver does the flashing differently.
I only tested this in the latest version of watir-classic, but the code for 2.0.4 appears to be the same.
Example - Default Flash Colour
To change the default flash colour for everything, you need to set the activeObjectHighLightColor for the browser.
If you want to change it for the current browser, do:
ie = Watir::Browser.new
ie.activeObjectHighLightColor = "green"
ie.goto 'www.google.ca'
e = ie.text_field(:name => 'q')
e.flash
#=> Will flash green
If you want to change it permanently (ie so you do not have to set it each time), you can change the colour in the ie-class.rb file:
HIGHLIGHT_COLOR = 'yellow'

Resources