更新:不,不,这不是重复上述问题。感谢您的反对,但这个问题是关于每个项目被切断。对不起,如果这不明确。如何在RecyclerView中设置项目的高度以适应所有元素?
我有RecyclerView.Adapter和Recycler视图。
return new MyViewHolder(v);
问题是项目布局中的最后一个元素被切断了每个项目。只有一半的评级栏明星是可见的,所以我想增加物品的高度。该项目的布局如下所示”
<FrameLayout
height=wrap_content
....
<RelativeLayout
height=match-parent
<ImageView
width=100dp
height=100dp
centerVertical=true >
<TextView
id=tv1
toTheEndOf="imageId"
toTheRightOf="imageId"
>
<TextView
id=tv2
below="tv1"
toStartOf="tv1"
>
<TextView
id=tv3
below=tv2"
<TextView id=tv4
below=tv3
<RatingBar // After adding tv3 only half of rating bar is shown?
below=tv4
height=wrap-content/>
<RelativeLayout>
</FrameLayout>
更新:切换的RelativeLayout为wrap_content所示一切的结果,但现在TV2出现有时超过TV2有时是上面,但距离太近
的[RecyclerView被切断的最后一个项目]可能的复制(https://stackoverflow.com/questions/32742724/recyclerview-is-cutting-off-the -last-item) – marmor
没有@marmor它不是重复的,因为它不是列表中的最后一个项目,它是项目中每个项目的最后一个元素。 – gitsensible