Skip to content

Commit

Permalink
修复了3张或者9张图的情况下,时间线没有占满屏幕的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
郭文明 committed Aug 15, 2016
1 parent 04e280d commit 8bb87b0
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ public void onClick(View v) {
}

/**
* 单张图片的时候,从预设的3种图片尺寸中随机选一种
* 根据图片的数量,设置不同的尺寸
*
* @param datas
* @param context
* @param norImg
Expand All @@ -555,6 +556,8 @@ private static void setImgSize(ArrayList<String> datas, Context context, ImageVi
setSingleImgSize(context, norImg, longImg, gifImg);
} else if (datas.size() == 2 || datas.size() == 4) {
setDoubleImgSize(context, norImg, longImg, gifImg);
} else if (datas.size() == 3 || datas.size() >= 5) {
setThreeImgSize(context, norImg, longImg, gifImg);
}
}

Expand Down Expand Up @@ -582,6 +585,18 @@ private static void setSingleImgSize(Context context, ImageView norImg, Subsampl
gifImgLayout.height = (int) (ScreenUtil.getScreenWidth(context) * 0.7);
}

private static void setThreeImgSize(Context context, ImageView norImg, SubsamplingScaleImageView longImg, GifImageView gifImg) {
FrameLayout.LayoutParams norImgLayout = (FrameLayout.LayoutParams) norImg.getLayoutParams();
FrameLayout.LayoutParams longImgLayout = (FrameLayout.LayoutParams) longImg.getLayoutParams();
FrameLayout.LayoutParams gifImgLayout = (FrameLayout.LayoutParams) gifImg.getLayoutParams();
longImgLayout.width = ScreenUtil.getScreenWidth(context) / 3;
norImgLayout.width = ScreenUtil.getScreenWidth(context) / 3;
gifImgLayout.width = ScreenUtil.getScreenWidth(context) / 3;
norImgLayout.height = ScreenUtil.getScreenWidth(context) / 3;
longImgLayout.height = ScreenUtil.getScreenWidth(context) / 3;
gifImgLayout.height = ScreenUtil.getScreenWidth(context) / 3;
}

/**
* 为Gif图设置图标,根据url来决定是否设置
*
Expand Down

0 comments on commit 8bb87b0

Please sign in to comment.