SimpleCursorAdapter() 是 SimpleCursorAdapter 类的构造函数。

 

描述:

SimpleCurosrAdapter 是一个将 Cursor 中的 columns 与在 XML 文件中定义的 TextViews 或 ImageViews 进行匹配的简易 adapter。你可以指定选择 Cursor 中的哪些 columns、用哪些 views 来显示这些 columns 、以及指定定义这些 views 的 xml 文件。 

也就是说,SimpleCursorAdapter 允许绑定一个 Cursor 的 columns 到 ListView 上,并使用自定义的 layout 显示 List中的每个项目。

可以使用 SimpleCursorAdapter 作为中间桥梁,将从 sqlite 数据库中查询出来的数据直接显示到 ListView 中。

 

原型:

public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {
    super(context, layout, c);
    mTo = to;
    mOriginalFrom = from;
    findColumns(from);
}

相关文章:

  • 2021-10-12
  • 2021-11-14
  • 2021-08-25
  • 2021-05-30
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-30
  • 2021-08-23
  • 2021-11-23
  • 2021-10-03
  • 2022-12-23
  • 2021-05-26
相关资源
相似解决方案