2013-03-22 2 views
2

현재 TabActivity with android에서 작업 중이며 4 탭이 있고 4th 탭에서 기본 클래스는 calss이고 다른 클래스는 class B, class c, my입니다. 질문은 내가 4th 번째 탭을 클릭 할 때 tabview.is it.please 도와주세요 클래스 c를 laod 싶어요. 다른 클래스를 추가 할 수 있습니다 android에서 tabview에서 하위 클래스를로드하는 방법

TabHost mTabHost; 
    TabHost.TabSpec spec; // Resusable TabSpec for each tab 
    Intent intent; // Reusable Intent for each tab 

지금 당신의 클래스를 추가 예 당신이 할 수있는

답변

0

,

mTabHost = getTabHost(); 
    // Create an Intent to launch an Activity for the tab (to be reused) 
    intent = new Intent().setClass(this, A.class); 
    // Initialize a TabSpec for each tab and add it to the TabHost 
    spec = mTabHost 
      .newTabSpec("Class A") 
      .setIndicator("Class A", res.getDrawable(R.drawable.home_selector)) 
      .setContent(intent); 
    mTabHost.addTab(spec); 

같은 방법은, 여기에 내가 3 개 클래스의 사용을 drawble 배경

+0

을 사용, 클래스 A , class B, class C. tabbar는 클래스 A를로드하지만 일부 조건이 충족되면 클래스 A가 이전에로드 된 탭과 동일한 탭에 클래스 c를로드해야합니다. –

+0

플래그 값으로 처리 할 수 ​​있습니다 (클래스 C보다 true 인 경우). 그렇지 않으면 클래스 A –

관련 문제