我有一个带有3个XML选项卡的Action Bar(ViewPager)...我可以通过代码修改第三个XML或将XML链接到公共类吗?我唯一能做的就是通过android XML代码修改按钮或背景!这是代码:
public static class TabFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
public static final String ARG_OBJECT = "object";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle args = getArguments();
int position = args.getInt(ARG_OBJECT);
int tabLayout = 0;
switch (position) {
case 0:
tabLayout = R.layout.tabpracticeonenote1;
break;
case 1:
tabLayout = R.layout.tabpracticeonenote2;
break;
case 2:
tabLayout = R.layout.tabpracticeonenote3;
break;
}
}