问题描述
问题解答
回答1:你获取到RecyclerView item的视图对象,直接调用getWidth()自然就获取到了它的宽度。
回答2:recyclerView.getLayoutManager().getChildAt(0).getHeight();得到指定postition的item
回答3:这个问题得分情况回答了:
如果视图准备好(即视图可见), 找到ItemView并直接调用getWidth()
如果视图未准备好, 则需要借助View#post(Runnable)来实现, ----在run()中调用getWidth()