Android Fragment no view found for ID?

前端 未结 30 1956
逝去的感伤
逝去的感伤 2020-11-22 05:33

I have a fragment I am trying to add into a view.

FragmentManager fragMgr=getSupportFragmentManager();
feed_parser_activity content = (feed_parser_activity)f         


        
30条回答
  •  渐次进展
    2020-11-22 05:53

    I was having this problem too, until I realized that I had specified the wrong layout in setContentView() of the onCreate() method of the FragmentActivity.

    The id passed into FragmentTransaction.add(), in your case R.id.feedContentContainer, must be a child of the layout specified in setContentView().

    You didn't show us your onCreate() method, so perhaps this is the same problem.

提交回复
热议问题