private View getImageView(Context context, int resId) {
/* 设置某一页面的view */
RelativeLayout relativeLayout = new RelativeLayout(context);
ImageView imageView = new ImageView(context);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(layoutParams);
// 设置一个半透明的黑色背景,防止白字受白色图片干扰而无法显示
ImageView background = new ImageView(context);
background.setLayoutParams(layoutParams);
background.setBackgroundResource(R.color.colorCycleViewBannerBackground);
relativeLayout.addView(imageView);
relativeLayout.addView(background);
Picasso.with(context).load(resId).into(imageView);
return relativeLayout;
}
MainCycleViewPager.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:Paper-Melody
作者:
评论列表
文章目录