SVG矢量圖

? ? ? ? ? ? ? ? ? 簡(jiǎn)單的矢量圖方法

? 1.導(dǎo)入依賴

compile'com.eftimoff:android-pathview:1.0.8@aar'

? 2.通過(guò)online免費(fèi)在線文件轉(zhuǎn)換器轉(zhuǎn)換想要改變的簡(jiǎn)單圖片為SVG文件

online網(wǎng)址:https://www.online-convert.com/

?3.將轉(zhuǎn)換后的xml文件存入Studio中res目錄下raw包中

?4.在布局中添加PathView控件

<com.eftimoff.androipathview.PathView

? ? android:id="@+id/mPathView"

? ? app:pathColor="#ff3c00"

? ? app:pathWidth="2dp"

? ? app:svg="@raw/yu"

? ? android:layout_width="match_parent"

? ? android:layout_height="match_parent" />



app:pathColor="#ff3c00"http://設(shè)線條顏色

app:pathWidth="2dp"http://設(shè)置線條寬度

app:svg="@raw/yu"http://設(shè)置需要展示的矢量圖

5.在Activity中初始化控件通過(guò)鏈?zhǔn)秸{(diào)用來(lái)展示出來(lái)

mPathView = (PathView) findViewById(R.id.mPathView);

mPathView.getPathAnimator()

.delay(500)

.duration(3000)

.listenerEnd(new PathView.AnimatorBuilder.ListenerEnd() {

@Override

? ? ? ? ? ? public void onAnimationEnd() {

Toast.makeText(MainActivity.this,"svg加載成功", Toast.LENGTH_SHORT).show();

}

}).interpolator(new AccelerateInterpolator()).start();

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容