我是Android的新手,想要在我的应用中使用动态的tablelayout。下面的json已发布,我想要一个表格布局显示标题为" Service"标记(清洗)作为第一个表格行和其下面的细节:"成本" &安培;"量&#34 ;.然后是一个光滑的黑色线条&然后标题2(服务:熨烫)及其细节。我不知道如何遍历json字段。请帮助我。
[{"标签":"5公斤""服务":"洗涤"" SERVICE_TYPE&#34 ;: "正常交付","成本":" 100","数量":"直到5kg"},{& #34;标签":" 5公斤 - 7公斤","服务":"洗涤","服务类型":"正常交付","成本":" 200","数量":" 5千克 - 7千克"},{&#34 ;标签":"超过7公斤","服务":"洗涤","服务类型":"正常交付&# 34;,"费用":" 300","数量":"超过7公斤"},{"标签" :" 5千克","服务":"熨烫","服务类型":"正常交付"," ;成本":" 100","数量":" 5千克"},{"标签":" 5千克 - 7千克","服务":"熨烫","服务类型":"正常交付","成本" :" 200","数量":" 5千克 - 7千克"},{"标签":"超过7千克" "服务":&#34 ;熨烫","服务类型":"正常交付","费用":" 300","数量&#34 ;:"超过7公斤"},{"标签":" 5公斤","服务":"羊毛洗涤" ," Service_type":"正常交付","费用":" 100","数量":&#34 ; 5公斤"},{"标签":" 5公斤 - 7公斤","服务":"羊毛洗涤"," ; Service_type":"正常交付","成本":" 200","数量":" 5千克 - 7千克& #34;},{"标签":"超过7公斤","服务":"羊毛洗涤","服务类型&# 34;:"正常交付","成本":" 300","数量":"超过7千克"} ,{"标签":" 5公斤","服务":"洗涤和折叠","服务类型":& #34;正常交付","成本":" 100","数量":" 5千克"},{&#34 ;标签":" 5公斤 - 7公斤","服务":"洗涤和折叠"," Se rvice_type":"正常交付","成本":" 200","数量":" 5kg - 7kg&# 34;}]
答案 0 :(得分:0)
json有一个java API
http://www.oracle.com/technetwork/articles/java/json-1973242.html [编辑:不在Android上]
在Android上有GSON https://github.com/google/gson
http://www.javacodegeeks.com/2011/01/android-json-parsing-gson-tutorial.html
或使用android的内置函数:How to parse JSON in Android
动态表格布局即在此主题中: Android : Dynamic TableLayout