2
Ive는 온라인 자습서에서 큰 이미지를 볼 수있는 코드를 가지고 있습니다. 1.5와 잘 작동하지만 Android 2.2 라이브러리를 사용하면 작동하지 않습니다. (내 응용 프로그램 2.2 사용) 나는이 문제에 대한 해답을 찾았지만 운이 없다. drawable 폴더와 관련이있을 수 있습니다. 이미지가로드되지만 확대/축소 또는 동영상 이동과 같은 작업을 수행 할 수 없습니다.1.5 용으로 개발 된 응용 프로그램은 2.2에서 실행되지 않습니다. android
private void updateDisplay(){
calculateSourceRect(current_centerX, current_centerY, current_scale);
//where sourceRect = new RectF(); and destinationRect = new RectF();
matrix.setRectToRect(sourceRect, destinationRect, Matrix.ScaleToFit.FILL);
androidBigImageView.setImageMatrix(matrix);
}
private void calculateSourceRect(int centerX, int centerY, float scale){
int xSubValue;
int ySubValue;
if(destinationRect.bottom >= destinationRect.right){
ySubValue = (int)((imageSizeY/2)/scale);
xSubValue = ySubValue;
xSubValue = (int) (xSubValue * ((float)androidBigImageView.getWidth()/(float)androidBigImageView.getHeight()));
}
else{
xSubValue = (int)((imageSizeX/2)/scale);
ySubValue = xSubValue;
ySubValue = (int) (ySubValue * ((float)androidBigImageView.getHeight()/(float)androidBigImageView.getWidth()));
}
if(centerX - xSubValue < 0) {
animation.stopProcess();
centerX = xSubValue;
}
if(centerY - ySubValue < 0) {
animation.stopProcess();
centerY = ySubValue;
}
if(centerX + xSubValue >= imageSizeX) {
animation.stopProcess();
centerX = imageSizeX - xSubValue - 1;
}
if(centerY + ySubValue >= imageSizeY) {
animation.stopProcess();
centerY = imageSizeY - ySubValue - 1;
}
current_centerX = centerX;
current_centerY = centerY;
sourceRect.set(centerX - xSubValue, centerY - ySubValue, centerX + xSubValue, centerY + ySubValue);
}
시도'androidBigImageView.setScaleType (ScaleType.MATRIX)를 시도,' – Aidanc
당신에게 Aidanc 감사합니다! 매력처럼 일했습니다! – Alanagh
괜찮습니다. 나는 대답을했습니다;) – Aidanc