SVG矢量圖

? ? ? ? ? ? ? ? ? 簡單的矢量圖方法

? 1.導入依賴

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

? 2.通過online免費在線文件轉換器轉換想要改變的簡單圖片為SVG文件

online網址:https://www.online-convert.com/

?3.將轉換后的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://設線條顏色

app:pathWidth="2dp"http://設置線條寬度

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

5.在Activity中初始化控件通過鏈式調用來展示出來

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();

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容