{
“activeSize”: 16,
“normalSize”: 14,
“activeColor”: “#ED7282”,
“normalColor”: “#666666”,
“select”: 0,
“tabGravity”: 0,
“tabs”: [
{
“title”: “图片”,
“index”: 0,
“tag”: “pics”,
“enable”: true
},
{
“title”: “视频”,
“index”: 1,
“tag”: “video”,
“enable”: true
},
{
“title”: “文本”,
“index”: 1,
“tag”: “text”,
“enable”: true
}
]
}
- 解析json文件
/**
-
获取普通导航栏
-
@return
*/
public static SofaTab getSofaTabConfig() {
if (sSofaTab == null) {
String content = parseFile(“sofa_tabs_config.json”);
sSofaTab = JSON.parseObject(content, SofaTab.class);
Collections.sort(sSofaTab.getTabs(), (o1, o2) -> {
return o1.getIndex() < o2.getIndex() ? -1 : 1;
});
}
return sSofaTab;
}
private static String parseFile(String fileName) {
AssetManager assets = AppGlobals.getApplication().getAssets();
InputStream is = null;
BufferedReader br = null;
StringBuilder builder = new StringBuilder();
try {
is = assets.open(fileName);
b