listView_myNote = (AutoRefreshListView) this.findViewById(R.id.note_list_view); int w = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED); listView_myNote.measure(w, h);Log.i("screen","listView_myNote width "+w);为什么打印的是 0 啊 AutoRefreshListView的layout_height 设置的fill_parent
1.可以用View.MeasureSpec.makeMeasureSpec设置,然后用getMeasuredHeight()
2.用ViewTreeObserver参考资料
1 试了下没有用
2 可以用,但是在onResume后开始画的时候可能不是想调用方法的地方谢谢了,再找其他办法解决
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
这段代码,项目中是不是下面有Fragment.xml
如果有的话,请参照下面http://blog.csdn.net/u013671350/article/details/37742673.
希望帮助到你
listView_myNote = (AutoRefreshListView) this.findViewById(R.id.note_list_view);
int w = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
int h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
listView_myNote.measure(w, h);Log.i("screen","listView_myNote width "+w);为什么打印的是 0 啊
AutoRefreshListView的layout_height 设置的fill_parent