我已经知道了RecyclerView
,它显示了一个带有姓名,电话和生日的人的列表。
如果该人的生日是今天,我想更改商品的颜色,但是我想知道是否应该验证并更改方法中的RecyclerView's
适配器OnBindViewHolder
,还是应该在我的活动中调用我的对象LinearLayoutManager
或调用该对象?使用该RecyclerView.getChildAt()
方法的项目。
我应该使用白色onBindViewHolder
吗?
是的。您是否应该选择在中进行更改onBindViewHolder()
。我们将取样:
@Override
public void onBindViewHolder(FeedsViewHolder feedViewHolder, int i)
{
if(d1.feeds.get(i).getFeedContentType().equals("b-day")) // <-- Pointing to the List that contains value, and checks if it equals to a sample string
{
feedViewHolder.n1.setText("Birthday"); // <-- if it equals, party time :D , and sets text to the corresponding TextView in the RecyclerView
}
}
希望能帮助到你 :)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句