在 android 中创建动态视图?

Create dynamic view in android?

在我的申请中,我收到 JSON 多个这样的表格:

"forms":[ {"name": "form1","title": "First Form","order": 1,
           "fields":[
                    "name": "firstName","type": "InputText", "maxLength": "10",
                    "restriction": "text"},
          {"name": "lastName","type": "InputText","maxLength": "10","restriction": "text"}
                    ]
          },
          {"name": "form2","title": "Second Form","order": 2,
          "fields": [
                    {"name": "email","type": "InputText","maxLength": "50","restriction": "email"},
                    {"name": "gender","type": "dropdown","values": [male,female]},
                    {"name": "married","type": "boolean"}
                    ]
          }
       ]

inputText=editText , dropDown=spinner, boolean=checkBox

我正在尝试将我的视图分为每个表单的部分,正如您所看到的每个表单都有不同的字段,请问有人能告诉我这样做的想法吗?

您可以使用选项卡 activity , android Navigation Drawer , android swipe view 然后将每个字段分配给不同的部分