我读过的所有内容都说你不能在构造函数中调用or getWidth()
,但我在. 屏幕的布局不应该已经画好了吗?getHeight()
View
onResume()
@Override
protected void onResume() {
super.onResume();
populateData();
}
private void populateData() {
LinearLayout test = (LinearLayout) findViewById(R.id.myview);
double widthpx = test.getWidth();
}