认证0级讲师
Once you get RecyclerView item的视图对象,直接调用getWidth(), you will naturally get its width.
RecyclerView
item
getWidth()
recyclerView.getLayoutManager().getChildAt(0).getHeight();Get the item of the specified postition
The score of this question was answered:
If the view is ready (i.e. the view is visible), find the ItemView and call getWidth() directly
If the view is not ready, you need to use View#post(Runnable) to achieve it, ----Call getWidth() in run()
Once you get
RecyclerView
item
的视图对象,直接调用getWidth()
, you will naturally get its width.recyclerView.getLayoutManager().getChildAt(0).getHeight();
Get the item of the specified postition
The score of this question was answered:
If the view is ready (i.e. the view is visible), find the ItemView and call getWidth() directly
If the view is not ready, you need to use View#post(Runnable) to achieve it, ----Call getWidth() in run()