public class MainActivity extends Activity
{

   @Override
   protected void onCreate(Bundle savedInstanceState)
   {
      super.onCreate(savedInstanceState);

      ImageView  imageView = (ImageView) findViewById(R.id.yourImageView);
      imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
      try
      {
         SVG svg = SVG.getFromResource(this, R.raw.my_svg_file);
         Drawable drawable = new PictureDrawable(svg.renderToPicture());
         imageView.setImageDrawable(drawable);
      }
      catch(SVGParseException e)
      {}
   }

}

地址:http://bigbadaboom.github.io/androidsvg/use_with_ImageView.html
Github:https://github.com/BigBadaboom/androidsvg

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注