示例#1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_svg_demo);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mImageView = (ImageView) findViewById(R.id.iv_image);
    mButton = (Button) findViewById(R.id.bt_button);

    mSvg = Sharp.loadResource(getResources(), R.raw.cartman);
    // If you want to load typefaces from assets:
    //          .withAssets(getAssets());

    // If you want to load an SVG from assets:
    // mSvg = Sharp.loadAsset(getAssets(), "cartman.svg");

    mButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            reloadSvg(true);
          }
        });

    mAttacher = new PhotoViewAttacher(mImageView);
    mAttacher.setMaximumScale(10f);

    reloadSvg(false);
  }
示例#2
0
 @Override
 @Deprecated
 public void setMaxScale(float maxScale) {
   setMaximumScale(maxScale);
 }
示例#3
0
 @Override
 public void setMaximumScale(float maximumScale) {
   mAttacher.setMaximumScale(maximumScale);
 }