从android中的json创建动态表单

时间:2015-04-03 09:25:00

标签: java android

我是android开发的新手。我正在制作一个像学生注册这样的应用程序,因此我想从JSON文件动态创建表单。并且这些表单在向导中就像视图一样。我不知道如何动态地执行此操作请帮助我创建它。

我有以下JSON文件:

{
    "screen1": {
    "Basic Information" :[
        {
            "id": "3",
            "type": "birthdate",
            "ordering": "2",
            "name": "Birthdate",
            "tips": "Enter your date of birth so other users can know when to wish you happy birthday ",
            "options": "",
        },
        {
            "id": "4",
            "type": "textarea",
            "ordering": "3",
            "name": "About me",
            "tips": "Tell us more about yourself",
            "options": "",
        },
        {
            "id": "16",
            "type": "select",
            "ordering": "4",
            "name": "marital status",
            "tips": "single or married",
            "options": [
                "Married",
                "Unmarried",
                "Divorcee"
            ],

        }
    ]
},

    "screen3":
    {
     "Education" :[
        {
            "id": "14",
            "type": "text",
            "name": "College / University",
            "tips": "Your college or university name",
            "options": "",
        },
        {
            "id": "15",
            "type": "text",
            "ordering": "16",
            "name": "Graduation Year",
            "tips": "Graduation year",
            "options": "",
        }
    ]
}
}

1 个答案:

答案 0 :(得分:0)

抱歉,答案很长:  尝试:

  

“screen1”: - > “\”screen1 \“”+“:”   像这样,只改变“到”\“”