就是SD卡的图片太大了,进行缩放一下就可以了
public class MainActivity extends Activity {
private ImageView iv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
iv=(ImageView) findViewById(R.id.iv);
String path=Environment.getExternalStorageDirectory()+"/1439007560370.png";
Bitmap bitmap = BitmapFactory.decodeFile(path);
int height = (int) ( bitmap.getHeight() * (512.0 / bitmap.getWidth()) );
Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 512, height, true);
iv.setImageBitmap(scaled);
}
}