
回复
@TOC
<Button
ohos:id="$+id:bottom_play_btn"
ohos:height="50vp"
ohos:width="50vp"
ohos:margin="10vp"
ohos:background_element="$graphic:ic_play"/>
首先我们看一下官方给定的方法:
在这里给定的参数是Element类,查看文档可知下面的类有
其中关于 ==VectorElement==的描述为
Provides an Element object that supports vector drawing.
You can use this class to draw vector elements to prevent image distortion after scaling.
由此我们可以使用下面方法来将 ==xml== 用来更新Background
playBtn.setBackground(new VectorElement(this,ResourceTable.Graphic_ic_pause));