【发布时间】:2013-04-15 18:05:25
【问题描述】:
如何在 FragmentDialog 中使用 Activity 中的文本设置 Title?
【问题讨论】:
如何在 FragmentDialog 中使用 Activity 中的文本设置 Title?
【问题讨论】:
您可以尝试使用参数来这样做:
关于你的活动:
Bundle arguments = new Bundle();
Fragment fragment = new YourDialogFragment();
arguments.putSerializable(KEYNAME, YOUR_SERIALIZABLE_ITEM);
fragment.setArguments(arguments);
getFragmentManager().beginTransaction().add(R.id.your, fragment).commit();
在你的片段上:
if (getArguments().containsKey(KEYNAME))
(ObjectType) getArguments().getSerializable(KEYNAME);
【讨论】: