在android中创建动态视图?

时间:2016-09-11 06:58:34

标签: android arrays android-json

在我的应用程序中,我收到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

我想让我的观点分为每个表单的部分,因为您看到每个表单都有不同的字段,有人可以给我这样做的想法吗?

1 个答案:

答案 0 :(得分:0)

您可以使用标签式活动,android Navigation Drawerandroid swipe view,然后将每个字段分配到不同的部分