@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (BarStatusHeightUtil.checkDeviceHasNavigationBar(getActivity())){
BarStatusHeightUtil.hideBottomUIMenu(getActivity());
}
if(rootView == null){
rootView = inflater.inflate(getContentViewId(),container,false);
initViews();
initData();
addListener();
}else{
ViewGroup parent =(ViewGroup)rootView.getParent();
if (parent != null){
parent.removeView(rootView);
}
}
return rootView;
}
这是Basefragment
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
这是Alarmfragment
@Override
public void initViews() {
toolbar = view.findViewById(R.id.title_toolbar);
webView = view.findViewById(R.id.wv_warn);
initToolbars();
LoadWeb();
String erro = MyApplication.getCache().getAsString("error");
if (erro != null){
// warnJs(erro);
}
}
这是initViews