错误 不兼容的类型 ProductFragment无法转换为Fragment transactionreplaceRidmain_content productFragment;
解决方法:
将ProductFragment改为Fragment,即可解决此错误:
Fragment productFragment = new ProductFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, productFragment);
transaction.addToBackStack(null);
transaction.commit();
原文地址: https://www.cveoy.top/t/topic/eGBd 著作权归作者所有。请勿转载和采集!