我正在尝试在NativeScript中使用Android的
VectorDrawable
作为Image
源。 使用布局检查器,我可以看到有些东西,但没有显示图像。此外,没有关于缺少图像文件的错误,根本没有错误。我无法确定是否可能。非常感谢。VectorDrawable
作为Image
源。 使用布局检查器,我可以看到有些东西,但没有显示图像。此外,没有关于缺少图像文件的错误,根本没有错误。我无法确定是否可能。非常感谢。所以我不知怎么搞定了:
let context = application.android.context;
// vector is VectorDrawable name
let logo = context.getResources()
.getIdentifier(this.vector, "drawable", context.getPackageName());
this.el.nativeElement.android.setBackgroundResource(logo);
// Access CSS color to change fill color
let backgroundColor: string = (this.el.nativeElement.backgroundColor)
? this.el.nativeElement.backgroundColor.toString()
: SrcDirective.DEFAULT_COLOR;
let newBackgroundColor: Color = new Color(backgroundColor);
this.el.nativeElement.android.getBackground().setTint(newBackgroundColor.android);