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 {}
}
预先感谢您!