gpt4 book ai didi

android - 具有动态内容的动态标签生成

转载 作者:行者123 更新时间:2023-11-29 01:46:37 25 4
gpt4 key购买 nike

我有一个项目,我想在其中创建选项卡 View ,其中所有选项卡都是从 json 生成的依赖于 json。标签 View 的内容是 ListView , ListView 数据再次来自json。

这里我提供我的json文件

“checks”{“check”:{
“ref”:”1”,
“area”:”In Cab”,
“title”:”Condition of windscreen”,
“description”:”Check there are no cracks, that the windscreen is clean and not greasy.”,
“controlType”:”Check”,
“checkResult”:””,
“checkValue”:””
},
“check”:{
“ref”:”2”,
“area”:”External”,
“title”:”Windscreen wipers”,
“description”:”Check the wiper surface is smooth and not cut and the wiper touches the screen on its full length.”,
“controlType”:”Check”,
“checkResult”:””,
“checkValue”:””
},
“check”:{
“ref”:”3”,
“area”:”Input”,
“title”:”Registration”,
“description”:”Enter the registration number for the vehicle.”,
“controlType”:”TEXT”,
“checkResult”:””,
“checkValue”:””
},
“check”:{
“ref”:”4”,
“area”:”Input”,
“title”:”Mileage”,
“description”:”Enter the mileage for the vehicle.”,
“controlType”:”NUMBER”,
“checkResult”:””,
“checkValue”:””
},
“check”:{
“ref”:”5”,
“area”:”Input”,
“title”:”Tacho Expiry Date”,
“description”:”enter the tacho expiry date.”,
“controlType”:”DATE”,
“checkResult”:””,
“checkValue”:””
},
“check”:{
“ref”:”6”,
“area”:”Input”,
“title”:”Warning light colour”,
“description”:”Enter the warning light colour.”,
“controlType”:”SELECT”,
“selectValues”:”’Red, ‘Amber’,’’Green”,
“checkResult”:””,
“checkValue”:””
}
}

这里的tab是根据json中的area标签创建的

标签的内容是基于区域的标题,描述。
所以我很困惑如何创建标签以及如何在不同的标签中添加内容

提前致谢

最佳答案

试试这个:

btnAddTab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TabHost.TabSpec spec = tabHost.newTabSpec("Tab"+i);
spec.setContent(new TabHost.TabContentFactory() {
@Override
public View createTabContent(String tag) {
return new AnalogClock(MainActivity.this);
}
});
spec.setIndicator("Clock");
tabHost.addTab(spec);
}
});

关于android - 具有动态内容的动态标签生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21098076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com