public void setFragment(){
RegisterFragment fragment = new RegisterFragment();
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
transaction.add(R.id.fragment_container, fragment);
transaction.commit();
}
我正在尝试将Fragment
添加到Activity
,但它显示错误,
"无法解析符号fragment_container"
但是,我已经在xml
布局文件中定义了片段容器。