【发布时间】:2013-06-07 12:58:39
【问题描述】:
我有以下方法可以返回不同的片段:
@Override
public SherlockFragment getItem(int position) {
SherlockFragment fragment = null;
if (position == 0) {
fragment = new MyFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
} else if (position == 1) {
fragment = new MyFragment2();
Bundle args = new Bundle();
fragment.setArguments(args);
} else if (position == 2) {
fragment = new MyListFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
}
return fragment;
}
如何返回 2 次 SherlockFragment 和 1 次 SherlockListFragment?
【问题讨论】:
-
您好,我遇到了类似的问题,根据特定条件,我必须返回不同的片段。我该怎么办。请分享您的想法。 stackoverflow.com/questions/18030296/…可以
标签: android actionbarsherlock fragment android-listfragment