Change Text Color for Xamarin TimePicker - xamarin

How can I change the color of the text circled in the below screenshot?
I played around with the style.xml but have not yet found any property that impacts this parts.

Add the following code into style.xml in android project.
Create a new style which defines the color on Timepicker.
<style name="Theme.picker" parent="Theme.AppCompat.Light.Dialog">
//background color
<item name="android:background">#13216a</item>
//Title background color
<item name="colorAccent">#f8a519</item>
//text color
<item name="android:textColor">#FF0000</item>
//number text color
<item name="android:textColorPrimary">#FF66FF</item>
</style>
Apply the style in MainTheme .
<item name="android:timePickerDialogTheme">#style/Theme.picker</item>
Screen shot
Notice: This is a simple solution, and it will also change the button text color, if you want to separate them, you will need a custom renderer.

Related

Xamarin Android TimePicker how to change underline color using Styles

Currently the under line color is White, how would I change the color.
I've looked at this solution using style which I really like, but which property do I need to set to update this under line color?
Xamarin Android - Change colors for TimePicker keyboard view
In general, a property in style may affect the appearance of more than one control.
For example in your issue,you could try to define in your style to change the underline color like:
<style name="Theme.picker" parent="Theme.AppCompat.Light.Dialog">
<item name="colorControlNormal">#ff00ff</item> // the underline normal color which no focus
<item name="colorControlActivated">#ff0000</item>// the underline activate color which focus
</style>

Adjust size of popup balloon with embedded image to fit window size in KML file on Google Earth

Given is a KML file with a single placemark and an on-click popup ballon which can be opened in GoogleEarth. This balloon contains an image which is larger than what fits on the average screen. I would like the popup balloon to be dynamically sized to (almost) make use of the full screen, independent of the physical screen size or resolution. Inside this popup, the image should be scaled accordingly to be fully visible without scroll bars.
Current situation:
Desired situation:
Is this feasible somehow? I couldn't figure out any HTML/CSS combination yet to make it work.
This is the KML source for the upper screenshot:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Two large images stacked vertically and adjusted to screen size in popup balloon</name>
<Style id="abc123">
<IconStyle>
<color>000000</color>
<scale>0.50</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
<Placemark>
<name>Some placemark</name>
<styleUrl>#abc123</styleUrl>
<Point>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>4.732276,52.604905</coordinates>
</Point>
<description><![CDATA[<img src="https://images.unsplash.com/photo-1494256997604-768d1f608cac?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9" />]]></description>
</Placemark>
</Document>
</kml>
As the other answer indicated, you can size an image in a balloon using basic HTML tools. You can also do that dynamically using javascript to resize the image. But you seem to be asking if you can customize the image and balloon size based on the screen size, and unfortunately I don't know of any way for the HTML and Javascript in the balloon to know what the current screen size is, so I don't think it's possible to dynamically expand the image to fill the screen.
One possible alternative might be to have a smaller (thumbnail?) image in the balloon that links to the full-size image. That way users could click the image and open it in Earth's internal browser window, which automatically sizes to the screen.
The description in a Placemark can have HTML so one solution is by setting the height and width attributes in the <img> tag and another approach is adding a <div> tag with a width to control the width.
The screenshot below illustrates an image in a popup when setting a custom width.
KML Example:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Two large images stacked vertically and adjusted to screen size in popup balloon</name>
<Style id="abc123">
<IconStyle>
<color>000000</color>
<scale>0.50</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
<Placemark>
<name>Some placemark</name>
<styleUrl>#abc123</styleUrl>
<Point>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>4.732276,52.604905</coordinates>
</Point>
<description><![CDATA[
<img width="600" height="400"
src="https://www.w3schools.com/w3css/img_lights.jpg"/>
]]>
</description>
</Placemark>
</Document>
</kml>
Second approach is adding a <div> tag width a width.
<description><![CDATA[
<div style="width:624px;">
<img src="https://www.w3schools.com/w3css/img_lights.jpg"/>
</div>
]]></description>

Removing the margin/padding from the Entry in Xamarin Android via styles.xml

According to another StackOverflow question it's possible to remove the margin of a normal Button via styles.xml.
I would like to do the same for the margin/padding of Entry. Given that my trivial assumption would be that it uses an EditText beneath I tried:
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="editTextStyle">#style/MyEditText</item>
</style>
<style name="MyEditText" parent="Widget.AppCompat.EditText">
<item name="android:layout_margin">0dip</item>
</style>
Unfortunately, this doesn't have any effect. Even when I use 50dip as a value there's no effect. What are the correct setting in styles.xml to affect the Entry-widgit?
In your MainTheme.Base
<item name="android:editTextStyle">#style/EditTextStyle</item>
And your #style/EditTextStyle
<style name="EditTextStyle" parent="#android:style/Widget.EditText">
<item name="android:layout_margin">0dip</item>
<item name="android:padding">0dip</item>
</style>
Note: This going to depend upon your layout, as the "margins" are to parent Android layout containers (ViewGroup) and thus your Forms' Entry might not be effected. If you are not sure that you have set this up correctly, throw a color into the style to double check, something like all Entries having Green text:
<item name="android:textColor">#00f000</item>

Nativescript Datepicker change text color

I'm trying to change the datepicker color to white in Android. I've tried with colorPrimary in styles.xml with no luck:
<style name="AppTheme" parent="AppThemeBase">
<item name="android:datePickerStyle">#style/SpinnerDatePicker</item>
</style>
<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
<item name="colorPrimary">#FFF</item>
<item name="android:datePickerMode">spinner</item>
</style>
Also, is there a way to use one color in a component and another in a second or am I bound to use one color for the whole app?
You can't change the color of the DatePicker dynamically... at least it is not a trivial job. The thing is that even in native Android changing the color via code-behind can be achieved only with the Reflection API (see here for details).
To change the text color of the DatePicker there is one important thing to notice - you should apply android:textColorPrimary directly in the main app theme (see the comments here for details)
For example:
values-v21/style.xml
<style name="AppTheme" parent="AppThemeBase">
<item name="android:textColorPrimary">#color/ns_green</item> <!-- HERE -->
<item name="android:datePickerStyle">#style/SpinnerDatePicker</item>
<item name="android:timePickerStyle">#style/SpinnerTimePicker</item>
</style>
In the example above ns_green is defined in colors.xml
<color name="ns_green">#1eb234</color>

Is there any way to change datepicker border line colour in xamarin

When displaying datepicker in XAML page bottom borderline color is black. I want to change this color to white. How to solve this problem. Is there any custom renderer to set the bottom borderline color. I am using absolute layout in my XAML page. By default when displaying datepicker on my page the date with black bottom borderline color. I just want to change to white color.
I posted an answer yesterday for another user who wanted to change the bottom line color of a text view. You can most likely do it the same way with a custom DatePicker; simply change the background to the xml resource in your custom renderer.
See here:
How can i change editor bottom border line color using custom renderer in xamarin forms
Just change the color values in the XML code to color="white".
You have to create an XML file in drawable folder and add this styling. You can customize it according to the color you want.
Add this file to style of datepicker, Resource.Style.datepicker.
<style name="datepicker" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">#color/clrDatePrimary</item>
<item name="colorPrimaryDark">#color/clrDatePrimaryDark</item>
<item name="colorAccent">#color/clrDateAccent</item>
</style>

Resources