java - 如何将自定义布局用作表格布局中的视图
问题描述
我有一个布局,我想将其用作 TableLayout 中的元素。我试图将布局膨胀为视图,然后将它们添加到 TabelRow 中。由于某种原因它不起作用,我无法弄清楚为什么或如何解决它。
LayoutInflater inflater = LayoutInflater.from(this);
TableLayout sudokuGrid = (TableLayout) findViewById(R.id.sudokuGrid);
TableRow tableRow = new TableRow(this);
View cell = inflater.inflate(R.layout.cell_layout, null);
tableRow.addView(cell);
sudokuGrid.addView(tableRow);
解决方案
推荐阅读
- python - 为什么我的函数返回错误的值?
- html - 从网页上的选择列表中选择选项后,VBA 运行事件
- react-virtualized - 使用 React Virtualized 打破大行高度?
- android - Android APP - 拨打电话号码 net::ERR_UNKNOWN_URL_SCHEME
- android - View上的Android点击监听器以奇怪的方式工作
- node.js - Passport 获取刷新令牌 OAuth
- java - 带有表格的 PDF 到简单的图像 PDF
- python - 如何生成其元素在 Numpy 中的数组指定的两个边界内的所有数组?
- python - Selenium 找不到元素 - LinkedIn 中的“连接”按钮
- sharepoint - 仅在文件夹而非文档上实施元数据