2010-12-10 71 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(); 
相关问题