2016-11-07 43 views
-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(); 

这里主要当我点击按钮,它给人致命异常错误

回答