0
我有2个视图 - 容器视图和测量视图。我想以编程方式更改量表视图的高度。问题是,当我得到容器视图的高度时 - 它总是会回到2.0 - 即使高度是全屏!如何以编程方式设置视图的高度?
int fullHeight = containerView.getLayoutParams().height;
Number height = fullHeight * (thisTank.getTankTotalVolume().doubleValue()/thisTank.getTankMaxVolume().doubleValue());
Number width = gaugeView.getWidth();
//gaugeView.setLayoutParams(new LinearLayout.LayoutParams(width.intValue(), height.intValue()));
gaugeView.getLayoutParams().height = height.intValue() * fullHeight;
gaugeView.requestLayout();
这是伟大的谢谢!必须承认要努力改变到android开发! – HillInHarwich
快乐兄弟.... :) –