0
SVG-android 라이브러리를 다루는 데 문제가 발생했습니다. 내 주요 활동에서 그러나 SVG 개체를 imageview에 표시하려면이 오류가 발생했습니다.SVG Android 예외
package com.example.androidsvgdemo;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.larvalabs.svgandroid.SVG;
import com.larvalabs.svgandroid.SVGParser;
import android.os.Bundle;
import android.widget.ImageView;
import android.app.Activity;
public class MainActivity extends Activity {
ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView)findViewById(R.id.img1);
//Parse the SVG file from the resource
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.imageandroid);
//Get a drawable from the parsed SVG and apply to ImageView
imageView.setImageDrawable(svg.createPictureDrawable());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
하십시오 조언을 다음과 같이
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.androidsvgdemo/com.example.androidsvgdemo.MainActivity}:
com.larvalabs.svgandroid.SVGParseException:
org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed (invalid token)
내 코드입니다. 고맙습니다.
불행히도 Inkscape svg 파일을 읽지 않는 것 같습니다. http://www.clker.com/cliparts/C/G/j/0/u/S/animal-number-one.svg – Gavriel
귀하의 파일을 svg basic과 호환되지 않습니다. 또한 을 귀하의 svg에서 제거하고 변환 : 변환 및 행렬 ... –
avianey
에 적용하면 이것이 문제의 원인입니다. 그렇게 할 수있는 명령 줄 도구가 있다면 사전 처리 할 수 있습니다. 너는 어떤 것을 알고 있니? – Gavriel