2010-12-10 70 views

回答

0

我使用片段執行技巧:請參閱Android's Doc。所以,你應該在什麼都佈局,並通過點擊其中的一個展示4種不同的片段添加例如4個按鈕,下面是樣品展示一個片段:

FragmentTransaction ft = getFragmentManager().beginTransaction(); 
    Fragment prev = getFragmentManager().findFragmentByTag(TAG_APP_DIALOG); 
    if (prev != null) { 
     ft.remove(prev); 
    } 
    // Create and show the dialog fragment. 
    DialogFragment newFragment = AppDialogFragment.newInstance(folderName, this, appInfos); 
    newFragment.setRetainInstance(false); 
    ft.add(mRootLayout.getId(), newFragment, TAG_APP_DIALOG); 
    ft.commit(); 
相關問題