c
package com.zs.test_.fragment;
import java.util.HashMap;
public class MyFragment extends Fragment {
TextView tv_id, tv_share_my, tv_gold;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_my, container, false);
SharedPreferencesUtils sharedPreferencesUtils = SharedPreferencesUtils.getInstance(getActivity());
about_my = view.findViewById(R.id.about_my);
return view;
}
@Override
public void onDetach() {
super.onDetach();
EventBus.unregister(this);
}
}
1.继承于fragment
extends Fragment
2.将 XML 布局文件 (R.layout.fragment_no_fold_tab)解析为对应的 View 层次结构。
View view = inflater.inflate(R.layout.fragment_my, container, false);、