Reputation: 658
https://docs.nativescript.org/api-reference/classes/_ui_core_view_.view#setinlinestyle
Is there any example of this function?
let image = new Image();
image.height = 300dp;
image.setInlineStyle('background-image: url(~/images/my_img.png)')
OR
image.setInlineStyle('{ background-image: url(~/images/my_img.png) }')
Both are not working.
Have I misunderstood the usage of setInlineStyle
? Any idea? Thank you.
Upvotes: 2
Views: 319
Reputation: 438
If all you want to do is set the backgroundImage, I'd recommend you to set it this way instead,
let image = new Image();
image.height = 300dp;
image.backgroundImage = "url('~/images/my_img.png')";
Upvotes: 1
Reputation: 253
Try this,
image.setInlineStyle('background-image: url("~/images/my_img.png")')
Upvotes: 2