Android开发 动态表格(内容、样式可扩缩),kotlin操作符重载

这篇博客介绍了如何使用Kotlin处理动态表格数据,包括从JSON转换为对象,创建Map表格数据,并根据特定类型调整表头。主要涉及了MapTableData类的创建和操作,如设置表格名称、Map数组、表头格式等。
摘要由CSDN通过智能技术生成

e.printStackTrace();

}

return objs;

}

public static List jsonToObjs(String json, Class cls) {

return jsonToObjs(json, cls, false, dateFormat);

}

4.2 未完整的MapTableData.java,开始创建新表格

/**

  • 创建Map表格数据

  • @param tableName 表格名

  • @param mapList Map数组

*/

public static MapTableData create(String tableName, List mapList,String classity) {

return create(tableName, mapList, null,classity);

}

/**

  • 创建Map表格数据

  • @param tableName 表格名

  • @param mapList Map数组

  • @param keyFormat map中key格式化

*/

public static MapTableData create(String tableName, List mapList, IFormat keyFormat,String classity) {

if (mapList != null) {

List columns = new ArrayList<>();

getMapColumn(columns, Column.INVAL_VALUE, Column.INVAL_VALUE, mapList, keyFormat);

if(classity!=null&&!classity.isEmpty()){

//根据classity 设置表头

columns = getNewColumn(columns,classity);

}

return new MapTableData(tableName, mapList, columns);

}

return null;

}

private static List getNewColumn(List

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值