xamarin for android :How to setTextColor Set Xml Selector -


i want xml color selector set textview in java code.

mtext.settextcolor(getresources().getcolorstatelist(r.color.xml_color_selector)) 

how code work in xamarin?


found api here 1 , here 2. tried both of them, but:

mtext.settextcolor(android.content.res.resources. "not found getcolorstatelist"<br> mtext.settextcolor(resources. "not found getcolorstatelist" mtext.settextcolor(java.lang.classloader. "not found getresource" mtext.settextcolor(java.lang.class. "not found getresource" 

thanks.

p.s. want convert java code c# code , set xml selector textcolor in code.

this resources\drawable\xml_color_selector.xml
hope set textcolor drawable in activity

<selector xmlns:android="http://schemas.android.com/apk/res/android">   <item android:color="@color/menu_item_title_color_pressed" android:state_pressed="true" />   <item android:color="@color/menu_item_title_color" android:state_pressed="false" /> </selector> 


action setbackground works fine.

listitemview.setbackgroundresource(resource.drawable.menu_item_background_color_pressed); 

mtext.setbackgroundcolor (color.transparent); 

make sure color xml file in resource directory (resources -> values -> color.xml)

<?xml version="1.0" encoding="utf-8"?> <resources>     <color name="solid_red">#fff000</color>     <color name="transparent">#00000000</color>     <color name="black">#000000</color>     <color name="lightgrey">#bbbbbb</color>     <color name="grey">#333333</color>     <color name="white">#ffffff</color>     <color name="listseparator">#2a3748</color>     <color name="yellow">#fecf35</color>     <color name="blue">#00f</color> </resources> 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -