目前我是 Android 操作系统的新手,并试图让我的头脑了解片段 - 从 iOS 到 Android 创建一个应用程序,所以我需要尝试解决这个问题!
我在 Eclipse IDE 中使用了固定选项卡默认设置,它为我提供了 3 个选项卡。我可以更改选项卡菜单名称,但是我试图加载不同的片段让我们说:fragment_1
,fragment_2
以及fragment_3
单击标题时。
我找到了这段代码:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_1, container, false);
TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
return rootView;
}
并且我已将布局更改为fragment_1
,但是如何在单击选项卡的 x 处加载 fragment_x ?这可能吗?我已经搜索了网络,但到目前为止没有任何工作或有意义!