android - 如何得到recyclerview item的宽度?
PHP中文网
PHP中文网 2017-04-17 17:19:56
0
3
962
PHP中文网
PHP中文网

认证0级讲师

reply all(3)
小葫芦

Once you get RecyclerView item的视图对象,直接调用getWidth(), you will naturally get its width.

Ty80

recyclerView.getLayoutManager().getChildAt(0).getHeight();
Get the item of the specified postition

阿神

The score of this question was answered:

  1. If the view is ready (i.e. the view is visible), find the ItemView and call getWidth() directly

  2. If the view is not ready, you need to use View#post(Runnable) to achieve it, ----Call getWidth() in run()

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template