2

现在我想像这样设置标签小部件: 替代文字

我应该怎么做?我所知道的可能是修改Android源代码,有更好的想法吗?非常感谢!

4

1 回答 1

0

我使用 Fragment 来执行这个技巧:请参阅Android 的文档。因此,您应该在任何布局中添加例如 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();
于 2012-12-31T15:10:01.210 回答