是否可以将 TableLayout 与 ArrayAdapter 绑定? [英] Is it possible to bind a TableLayout with a ArrayAdapter?

查看:34
本文介绍了是否可以将 TableLayout 与 ArrayAdapter 绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将 TableLayout 与 ArrayAdapter 绑定?

Is it possible to bind a TableLayout with a ArrayAdapter?

推荐答案

框架中没有这样的 API.您可以通过自己查询适配器来手动完成.像这样:

There is no such API in the framework. You can do it manually by querying the adapter yourself. Something like this:

int count = adapter.getCount();
for (int i = 0; i < count; i++) {
    tableLayout.addView(createTableRow(adapter.getItem(i)); // or tableLayout.addView(adapter.getView(i, null, tableLayout));
}

这篇关于是否可以将 TableLayout 与 ArrayAdapter 绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆