Android 本地加载/网路下载图片实现放大缩小拖拉效果,自定义控件。
package com.example.ImageViewCustom; import android.app.Activity; import android.os.Bundle; import com.example.ImageViewCustom.CustomControl.MImageView; public class MyActivity extends Activity { MImageView mImageView; /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mImageView = (MImageView) findViewById(R.id.mImageView); //也可直接传入本地路径 mImageView.setImageUrl("http://pic51.nipic.com/file/20141022/19779658_171157758000_2.jpg");
//设置false就可以 放大缩小拖拉移动 mImageView.setDisableTouch(true); } }