Issue
I have several Android .XML Images, which supposedly loads faster.
In C#, how do I assign the XML file to an ImageSource.
Currently I have an example phone.xml file in the Drawable folder of my android project.
I try to call this:
var imgSource = ImageSource.FromFile("phone.xml");
but no image is displayed. Can I display an image directly from the drawable folder of the Android project?
Solution
You can use drawable/phone.xml
and as you mentioned in your comment drawable/phone
.
Obviously you’d need to add a conditional statement so it uses that string only for android:
string source = "phone.png";
if (Device.RuntimePlatform == Device.Android)
source = "drawable/phone"
var imgSource = ImageSource.FromFile(source);
Answered By - Saamer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.