fargment_home
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.shashank.iccca.test"
android:id="@+id/container"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
main_activity java
if (id == R.id.home)
{
Home home=new Home();
FragmentManager manager=getSupportFragmentManager();
manager.beginTransaction().replace(R.id.container1,home,home.getTag()).commit();
这里主要是当我点击按钮时它会给出致命的异常错误
答案 0 :(得分:0)
将R.id.container1
重命名为R.id.container