本文整理汇总了Java中com.larvalabs.svgandroid.SVGParser.getSVGFromResource方法的典型用法代码示例。如果您正苦于以下问题:Java SVGParser.getSVGFromResource方法的具体用法?Java SVGParser.getSVGFromResource怎么用?Java SVGParser.getSVGFromResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.larvalabs.svgandroid.SVGParser
的用法示例。
在下文中一共展示了SVGParser.getSVGFromResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setButtonData
import com.larvalabs.svgandroid.SVGParser; //导入方法依赖的package包/类
private final void setButtonData(ImageButton button, int bWidth, int bHeight,
int svgResId, SVG touched) {
SVG svg = SVGParser.getSVGFromResource(getResources(), svgResId);
button.setBackgroundDrawable(new SVGPictureDrawable(svg));
StateListDrawable sld = new StateListDrawable();
sld.addState(new int[]{android.R.attr.state_pressed}, new SVGPictureDrawable(touched));
button.setImageDrawable(sld);
LayoutParams lp = button.getLayoutParams();
lp.height = bHeight;
lp.width = bWidth;
button.setLayoutParams(lp);
button.setPadding(0,0,0,0);
button.setScaleType(ScaleType.FIT_XY);
}
示例2: onCreate
import com.larvalabs.svgandroid.SVGParser; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_svg_android_sample);
mMatrix = new Matrix();
mImageView = (ImageView) findViewById(R.id.image);
checkLayer(mImageView);
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.cute_fox);
mImageView.setImageDrawable(svg.createPictureDrawable());
mImageView.setImageMatrix(mMatrix);
final ScaleGestureDetector detector = new ScaleGestureDetector(this,
this);
mImageView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return detector.onTouchEvent(event);
}
});
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:24,代码来源:SvgAndroidSampleActivity.java
示例3: onCreate
import com.larvalabs.svgandroid.SVGParser; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = (ImageView) findViewById(R.id.imageView);
imageView.setBackgroundColor(Color.WHITE);
// Parse the SVG file, using svg-android
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
Log.d("MainActivity", "disabling hw acceleration");
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.x);
imageView.setImageDrawable(svg.createPictureDrawable());
}
示例4: updateButtons
import com.larvalabs.svgandroid.SVGParser; //导入方法依赖的package包/类
private final void updateButtons() {
boolean largeButtons = settings.getBoolean("largeButtons", false);
Resources r = getResources();
int bWidth = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics()));
int bHeight = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics()));
if (largeButtons) {
if (custom1ButtonActions.isEnabled() &&
custom2ButtonActions.isEnabled() &&
custom3ButtonActions.isEnabled()) {
Configuration config = getResources().getConfiguration();
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
bWidth = bWidth * 6 / 5;
bHeight = bHeight * 6 / 5;
} else {
bWidth = bWidth * 5 / 4;
bHeight = bHeight * 5 / 4;
}
} else {
bWidth = bWidth * 3 / 2;
bHeight = bHeight * 3 / 2;
}
}
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.touch);
setButtonData(custom1Button, bWidth, bHeight, custom1ButtonActions.getIcon(), svg);
setButtonData(custom2Button, bWidth, bHeight, custom2ButtonActions.getIcon(), svg);
setButtonData(custom3Button, bWidth, bHeight, custom3ButtonActions.getIcon(), svg);
setButtonData(modeButton, bWidth, bHeight, R.raw.mode, svg);
setButtonData(undoButton, bWidth, bHeight, R.raw.left, svg);
setButtonData(redoButton, bWidth, bHeight, R.raw.right, svg);
}
示例5: setClef
import com.larvalabs.svgandroid.SVGParser; //导入方法依赖的package包/类
public void setClef(Clef clef) {
_clef = clef;
SVG svg = SVGParser.getSVGFromResource(getResources(), clef._svgResource);
_clefPic = svg.getPicture();
int scaledWidth = _clefPic.getWidth() * _clef._height / _clefPic.getHeight();
_clefRect = new Rect(_clefLeft, _clef._top,
_clefLeft + scaledWidth, _clef._top + _clef._height);
}
示例6: setSVGResourceId
import com.larvalabs.svgandroid.SVGParser; //导入方法依赖的package包/类
public void setSVGResourceId(int id) {
mSvg = SVGParser
.getSVGFromResource(getContext().getResources(), id);
mPict = mSvg.getPicture();
mPict.endRecording();
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:7,代码来源:SVGRenderActivity.java