Get color from Xamarin.Forms.Color on android drawable XML -


is possible on drawable xml file?

<stroke android:width="1dp" android:color="xamarin.forms.color.red.toandroid" />

i want able have list of colors on shared project , able use them on xml files on android?

thanks.

via code, can use xamarin.forms.platform.android.colorextensions convert xamarin.forms color android.graphics.color.

within xamarin.android project (custom forms renderers, etc...):

android.graphics.color acolor = xamarin.forms.color.blue.toandroid() 

xamarin.forms.color based on w3c standards can use these android color xml resource file provide same colors within custom axml-based drawables/layout/etc...

<?xml version="1.0" encoding="utf-8"?> <resources>  <color name="white">#ffffff</color>  <color name="yellow">#ffff00</color>  <color name="fuchsia">#ff00ff</color>  <color name="red">#ff0000</color>  <color name="silver">#c0c0c0</color>  <color name="gray">#808080</color>  <color name="olive">#808000</color>  <color name="purple">#800080</color>  <color name="maroon">#800000</color>  <color name="aqua">#00ffff</color>  <color name="lime">#00ff00</color>  <color name="teal">#008080</color>  <color name="green">#008000</color>  <color name="blue">#0000ff</color>  <color name="navy">#000080</color>  <color name="black">#000000</color> </resources> 

note: not possible use code based / dynamic variables within axml files


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -