-2
fargment_home發現ID fragment_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();
這裏主要當我點擊按鈕,它給人致命異常錯誤