0
我正在編寫一個android應用程序,它有一個活動,其中包含多個片段。現在我想知道有沒有辦法將該活動分成幾個文件 - 每個片段都有單獨的文件?將活動拆分爲多個文件
爲了使我的問題更清楚,這裏是我的活動結構
public class MainActivity extends Activity implements ActionBar.TabListener
{
@Override
public Fragment getItem(int position) {
switch(position)
{
case 0:
return new Fragment1();
case 1:
return new Fragment2();
case 2:
return new Fragment3();
case 3:
return new Fragment4();
}
}
public static class Fragment1 extends Fragment {}
public static class Fragment2 extends Fragment {}
public static class Fragment3 extends Fragment {}
public static class Fragment4 extends Fragment {}
}
預先感謝您!