您好我一直在看開發商代碼放大視圖,我似乎不能是找出這個代碼該做的:getGlobalVisibleRect()究竟是什麼?
final ImageView expandedImageView = (ImageView) findViewById(
R.id.expanded_image);
expandedImageView.setImageResource(imageResId);
// Calculate the starting and ending bounds for the zoomed-in image.
// This step involves lots of math. Yay, math.
final Rect startBounds = new Rect();
final Rect finalBounds = new Rect();
final Point globalOffset = new Point();
// The start bounds are the global visible rectangle of the thumbnail,
// and the final bounds are the global visible rectangle of the container
// view. Also set the container view's offset as the origin for the
// bounds, since that's the origin for the positioning animation
// properties (X, Y).
thumbView.getGlobalVisibleRect(startBounds);
findViewById(R.id.container)
.getGlobalVisibleRect(finalBounds, globalOffset);
startBounds.offset(-globalOffset.x, -globalOffset.y);
finalBounds.offset(-globalOffset.x, -globalOffset.y);
1)具體我不是很確定什麼getGlobalVisibleRect(finalBounds,globalOffset)
猜想做?
2)另外,startBounds.offset()
假設要做什麼,-globalOffset.x,-globalOffset.y
甚至意味着什麼?
噢,謝謝。我發現之前和之前有聯繫,它仍然沒有幫助,所以我問這個問題。此外,我發現兩個stackoverflow帖子試圖回答這個問題,但答案非常模糊。 – Wowzer
@HaniyehKhaksar鏈接已損壞 –