本文整理汇总了Java中com.makeramen.roundedimageview.RoundedImageView.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java RoundedImageView.setLayoutParams方法的具体用法?Java RoundedImageView.setLayoutParams怎么用?Java RoundedImageView.setLayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.makeramen.roundedimageview.RoundedImageView
的用法示例。
在下文中一共展示了RoundedImageView.setLayoutParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidateParams
import com.makeramen.roundedimageview.RoundedImageView; //导入方法依赖的package包/类
void invalidateParams(){
stop();
removeAllViews();
looper.clear();
for(int i=0;i<mSize;i++){
RoundedImageView view = new RoundedImageView(getContext());
if(i!=0){
view.setBackgroundResource(R.drawable.drop_shadow);
view.setPadding(0,0,15,0);
}
view.setScaleType(ImageView.ScaleType.FIT_XY);
view.setCornerRadius((float) 10);
LayoutParams params = new LayoutParams(mChildWidth, mChildHeight);
view.setLayoutParams(params);
addView(view);
Banner banner = new Banner();
banner.view = view;
banner.position = i;
looper.add(banner);
view.setTag(i);
view.setOnClickListener(viewClickListener);
}
LogUtil.d(TAG, "invalidateParams");
}
示例2: resize
import com.makeramen.roundedimageview.RoundedImageView; //导入方法依赖的package包/类
private RoundedImageView resize(RoundedImageView view, int width, int height) {
float scale = 1.0f;
final Matrix matrix = new Matrix();
ViewGroup.LayoutParams params = view.getLayoutParams();
if (width > maxWidth && height > maxHeight) {
scale = Math.max(maxWidth * 1.0f / width, maxHeight * 1.0f / height);
params.width = maxWidth;
params.height = maxHeight;
}
if (width < minWidth && height < minHeight) {
scale = Math.max(minWidth * 1.0f / width, minHeight * 1.0f / height);
params.width = minWidth;
params.height = minHeight;
}
if (width > maxWidth && height < maxHeight) {
scale = maxWidth * 1.0f / width;
params.width = maxWidth;
params.height = minHeight;
}
if (height > maxHeight && width < maxWidth) {
scale = maxHeight * 1.0f / height;
params.width = minWidth;
params.height = maxHeight;
}
view.setLayoutParams(params);
matrix.postScale(scale, scale, params.width / 2, params.height / 2);
view.setImageMatrix(matrix);
return view;
}
示例3: UnwantedRandoView
import com.makeramen.roundedimageview.RoundedImageView; //导入方法依赖的package包/类
public UnwantedRandoView(Context context) {
super(context);
RoundedImageView roundedImageView = new RoundedImageView(context);
roundedImageView.setImageResource(R.drawable.ic_boring);
LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
roundedImageView.setLayoutParams(layoutParams);
roundedImageView.setOval(true);
addView(roundedImageView);
animation = AnimationUtils.loadAnimation(context, R.anim.show_hide_infinity);
startAnimation(animation);
}
示例4: resizeImageView
import com.makeramen.roundedimageview.RoundedImageView; //导入方法依赖的package包/类
private RoundedImageView resizeImageView(RoundedImageView view, int width, int height) {
ViewGroup.LayoutParams params = view.getLayoutParams();
int maxLength = DensityUtil.dip2px(MainApp.CONTEXT, 264);
int minLength = DensityUtil.dip2px(MainApp.CONTEXT, 40);
int shortOne = width >= height ? height : width;
int longOne = width >= height ? width : height;
if (width == 0 || height == 0) {
params.width = DensityUtil.dip2px(MainApp.CONTEXT, 112);
params.height = DensityUtil.dip2px(MainApp.CONTEXT, 112);
view.setLayoutParams(params);
return view;
}
if (width <= maxLength && height <= maxLength && width >= minLength && height >= minLength) {
params.width = width;
params.height = height;
view.setLayoutParams(params);
return view;
}
if (longOne / shortOne > maxLength / minLength) {
shortOne = minLength;
longOne = maxLength;
} else {
if (shortOne <= minLength) {
longOne = longOne * minLength / shortOne;
shortOne = minLength;
}
if (longOne >= maxLength) {
shortOne = shortOne * maxLength / longOne;
longOne = maxLength;
}
}
int viewWidth, viewHeight;
if (width >= height) {
viewWidth = longOne;
viewHeight = shortOne;
} else {
viewWidth = shortOne;
viewHeight = longOne;
}
params.width = viewWidth;
params.height = viewHeight;
view.setLayoutParams(params);
return view;
}