【发布时间】:2021-07-30 19:26:24
【问题描述】:
在 Harmony OS 中可以用什么来代替 TableRow? 它是 android 中 widget 包的一部分。
【问题讨论】:
标签: java android huawei-mobile-services huawei-developers harmonyos
在 Harmony OS 中可以用什么来代替 TableRow? 它是 android 中 widget 包的一部分。
【问题讨论】:
标签: java android huawei-mobile-services huawei-developers harmonyos
目前 Harmony 没有 TableRow 的任何特定替代方案,但我想说 TableLayout 中不需要 TableRow Harmony OS 的组件,因为您将能够在没有 TableRow 的情况下创建 TableLayout,例如
private TableLayout createTableLayout() {
tableLayout = (TableLayout) mDialogLayout.findComponentById(ResourceTable.Id_md_table_layout);
ComponentContainer.LayoutConfig layoutConfig = new ComponentContainer.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_CONTENT,
ComponentContainer.LayoutConfig.MATCH_CONTENT);
tableLayout.setRowCount(getRowCount());
tableLayout.setColumnCount(getColumnCount());
tableLayout.verifyLayoutConfig(layoutConfig);
for (int position = 0; position < getCount(); position++) {
CircleView cv = new CircleView(mContext);
cv.setLayoutConfig(cvlayoutConfig);
tableLayout.addComponent(cv);
}
return tableLayout;
}
【讨论】: