我想在我的代码下面的 html 标记中显示 json 我正在获取 json 并显示在两个不同的文本视图中,但我想以单行显示并显示所有 getJSONObject(i).getString("name")); 粗体名称和所有 getJSONObject(i).getString("sub_ingredients")); 在简单的文本中不想使用两个文本视图我想显示单个文本视图会做什么?我想显示为 html 标签
"dish_ingredient":
[
{"name":"Salt","sub_ingredients":""},
{"name":"Sesame Seeds","sub_ingredients":""},
{"name":"Calcium Sulfate","sub_ingredients":""},
{"name":"Brown Sugar","sub_ingredients":""},
{"name":"Salt","sub_ingredients":""},
{"name":"Hamburger Bun","sub_ingredients":""},
{"name":"Cheese-cultured pasteurized milk","sub_ingredients":""},
{"name":"Hamburger Bun","sub_ingredients":"Wheat, Niacin, Eggs"}]}
final LinearLayout table3 = (LinearLayout) findViewById(R.id.table3);
JSONArray school5 = json2.getJSONArray("dish_ingredient");
for (int i = 0; i < school5.length(); i++) {
row4 = getLayoutInflater().inflate(R.layout.row2, null);
((TextView) row4.findViewById(R.id.name)).setText(school5
.getJSONObject(i).getString("name"));
((TextView) row4.findViewById(R.id.subingredients))
.setText(school5.getJSONObject(i).getString( "sub_ingredients"));
table3.addView(row4);
}