阅读 90

GridVIew 居中布局工具类(自用)

public class LayoutConvertUtil {
    public static void layoutConvert(ImageView view, int w, int h,int pos) {
        ConstraintLayout.LayoutParams param = new ConstraintLayout.LayoutParams(w, h);
        if (pos%3==0) {
            param.startToStart=0;
        }else if (pos%3==1) {
            param.endToEnd=0;
            param.startToStart=0;
        }else if (pos%3==2) {
            param.endToEnd=0;
        }
        view.setLayoutParams(param);
    }
}
复制代码