我有一个表包含每行的图像数量。每行图像的数量根据图像宽度和屏幕宽度实时决定。当我正常使用手机时,图像会在手机屏幕上分开。当手机方向改变时,所有图像都出现在同一行上。我是否应该明确处理这种情况下的方向更改?处理方向变化android
// get the number of images per column based on the screen
// resolution
Display display = getWindowManager().getDefaultDisplay();
int screenWidth = display.getWidth();
Resources res = getResources();
Drawable drawable = res.getDrawable(R.drawable.emo_im_happy);
numberOfImagesPerRow = screenWidth/(drawable.getIntrinsicWidth() + 10);
int numberOfRows = (int) Math.ceil(numberOfEmotions
/numberOfImagesPerRow);