Using AndroidSVG with ImageView
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