====如何使dialog的高度随item的变化而变化

Window window = getWindow();
window.setGravity(Gravity.BOTTOM);
unitHeight = Controller.dip2px(aty, unitHeight);
int dialogH = 0;
int displayH = Controller.getDisplayHeight(aty) - Controller.dip2px(aty, 150);
int unitHei = (mainList.size() + 1) * unitHeight;
if (unitHei > displayH) {
    dialogH = displayH;
} else {

    dialogH = unitHei;
}
unitHeight=55;
getWindow().setLayout(Controller.getDisplayWidth(aty), dialogH);


aty为activity

你可能感兴趣的:(====如何使dialog的高度随item的变化而变化)