解决方案 »

  1.   

    你的这个fragment是加入到R.id.layout_main这个里面的?this.getFragmentManager().findFragmentById(R.id.fragment);这句就不能这么写,就直接this.findviewbyid();
      

  2.   

    哦,是的
    是不是
    this.getFragmentManager().beginTransaction().replace(R.id.layout_main, new PlaceholderFragment()).commit();
    这一句是用PlaceholderFragment的view把R.id.layout_main的view给替换掉了?那如果用add方法加的就能用
    this.getFragmentManager().findFragmentById(R.id.fragment);
    方式获得了?