当前位置: 首页>>代码示例>>Java>>正文


Java RoundedImageView.setLayoutParams方法代码示例

本文整理汇总了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");

}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:26,代码来源:BannerLayout.java

示例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;
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:30,代码来源:VideoRow.java

示例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);
}
 
开发者ID:RandoApp,项目名称:Rando-android,代码行数:12,代码来源:UnwantedRandoView.java

示例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;
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:45,代码来源:ImageRow.java


注:本文中的com.makeramen.roundedimageview.RoundedImageView.setLayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。