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"//设线条颜色

app:pathWidth="2dp"//设置线条宽度

app:svg="@raw/yu"//设置需要展示的矢量图

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容