1

나는 json에서 생성 된 모든 탭이 json에 의존하는 탭보기를 만들고 싶은 프로젝트가 있습니다. 이고 탭보기의 내용은 목록보기이며 다시 listview 데이터는 json에서 가져온 것입니다.동적 콘텐츠로 동적 탭 생성

여기

난 내 JSON이

여기
“checks”{“check”:{ 
        “ref”:”1”, 
        “area”:”In Cab”, 
        “title”:”Condition of windscreen”, 
        “description”:”Check there are no cracks, that the windscreen is       clean and not greasy.”, 
        “controlType”:”Check”, 
        “checkResult”:””, 
        “checkValue”:”” 
       }, 
     “check”:{ 
       “ref”:”2”, 
       “area”:”External”, 
       “title”:”Windscreen wipers”, 
       “description”:”Check the wiper surface is smooth and not cut and the wiper touches the screen on its full length.”, 
       “controlType”:”Check”, 
       “checkResult”:””, 
       “checkValue”:”” 
       }, 
     “check”:{ 
       “ref”:”3”, 
       “area”:”Input”, 
       “title”:”Registration”, 
       “description”:”Enter the registration number for the vehicle.”, 
       “controlType”:”TEXT”, 
       “checkResult”:””, 
       “checkValue”:”” 
       }, 
     “check”:{ 
       “ref”:”4”, 
       “area”:”Input”, 
       “title”:”Mileage”, 
       “description”:”Enter the mileage for the vehicle.”, 
       “controlType”:”NUMBER”, 
       “checkResult”:””, 
       “checkValue”:”” 
       }, 
     “check”:{ 
       “ref”:”5”, 
       “area”:”Input”, 
       “title”:”Tacho Expiry Date”, 
       “description”:”enter the tacho expiry date.”, 
       “controlType”:”DATE”, 
       “checkResult”:””, 
       “checkValue”:”” 
       }, 
     “check”:{ 
       “ref”:”6”, 
       “area”:”Input”, 
       “title”:”Warning light colour”, 
       “description”:”Enter the warning light colour.”, 
       “controlType”:”SELECT”, 
       “selectValues”:”’Red, ‘Amber’,’’Green”, 
       “checkResult”:””, 
       “checkValue”:”” 
       } 
} 

탭이 JSON

및 탭의 내용 영역 태그를 기반으로 만든 파일을 제공하고는 제목입니다 영역, 설명을 기반으로합니다.
그래서 내가 탭을 생성하는 방법과 사전에 다른 탭에

감사를 내용을 추가하는 방법에 대해 혼란 스러워요

+0

궁금 [이] (HTTP 경우 .com/questions/14251003/generate-to-generate-tabs-and-their-views-dynamic)를 사용하면 몇 가지 힌트를 얻을 수 있습니다. 그리고 [this] (http://stackoverflow.com/a/15417844/2683275) 또한 –

답변

1

노력이 : // 유래 :

btnAddTab.setOnClickListener(new OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      TabHost.TabSpec spec = tabHost.newTabSpec("Tab"+i); 
      spec.setContent(new TabHost.TabContentFactory() { 
       @Override 
       public View createTabContent(String tag) { 
        return new AnalogClock(MainActivity.this); 
       } 
      }); 
      spec.setIndicator("Clock"); 
      tabHost.addTab(spec); 
     } 
    });