我已经创建了linearlayout
和layout:height="fill_parent"
我设置了3个按钮和一个TextView。我能看到所有。但是当我想要得到linearlayout的高度。我在onCreate方法中使用了下面的代码。 I am getting linear layout height as zero.
但我的linearlayout高度是填充父项。还能看到我添加的元素。为什么我没有得到我的线性布局的实际高度。为什么线性布局的高度为零
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.main_linearlayout);
System.out.println("...Height..."+mainLayout.getMeasuredHeight());
感谢 迪帕克
你可以试试这个我已经回答了在这里 http://stackoverflow.com/questions/11964499/how-to-get-height-of-linearlayout/15803364#15803364 – 2013-04-04 05:47:55