简体   繁体   English

在android中从json创建动态表单

[英]Create Dynamic form from json in android

I am new in android development.我是 android 开发的新手。 I am making one application like student registration so in that I want to create form dynamically from JSON file.我正在制作一个像学生注册这样的应用程序,所以我想从JSON文件动态创建表单。 and that forms are in the wizard like view.并且表单在向导中就像视图一样。 I have no idea that how to do this dynamically please help me to create this.我不知道如何动态地做到这一点,请帮我创建这个。

I have following JSON file :我有以下 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": "",
        }
    ]
}
}

sorry for long answer: try:抱歉回答太长:尝试:

"screen1": -> "\\"screen1\\" " +":" like this, only change " to " \\" " "screen1": -> "\\"screen1\\" " +":" 像这样,只将 " 改为 " \\" "

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM