[英]Refresh just one row in a gridview
I have a gridview that is populated with an object of type List and whenever I do an update the whole gridview is refreshed.我有一个 gridview,其中填充了一个类型为 List 的 object,每当我进行更新时,整个 gridview 都会被刷新。 This would not be a problem with few records, but with many the process becomes quite slow... Is there any way to refresh the gridview but only by updating the row that was changed?
对于很少的记录,这不是问题,但是对于许多记录,过程变得非常缓慢......有没有办法刷新 gridview 但只能更新已更改的行?
Here is my code:这是我的代码:
if (DaIncrementa(artigo) == true)
{
Update(Convert.ToInt32(et.Text),true);
aberto = false;
}
else
{
Update(Convert.ToInt32(et.Text),false);
aberto = false;
}
FillDataNaoContados(familia);
IParcelable gridViewState = gvContagem.OnSaveInstanceState();
gvContagem.Adapter = new TextAdapter(this, artigos);
gvContagem.OnRestoreInstanceState(gridViewState);
Thank you!谢谢!
No there is not, you can use RecycerView
with gridLayotManager
instead of gridView
and use adapter.notifyItemRangeChanged()
to update a row or adapter.notifyItemChanged()
to notify just one cell,不,没有,您可以将
RecycerView
与gridLayotManager
而不是gridView
一起使用,并使用adapter.notifyItemRangeChanged()
更新一行或使用adapter.notifyItemChanged()
仅通知一个单元格,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.