繁体   English   中英

片段导航问题

[英]Fragment navigation issue

我有一个包含列表的片段。从列表中选择一个元素后,它会导航到具有某些特定数据的另一个片段。 当我从片段 2 向后按下时,我得到片段 1,其中列表显示了两次。

后按前的片段1

受压前

后按后的 Fragment1

背压后

下面是我从 Fragment1 到 Fragment2 的片段交易代码

    fragmentManager = mainActivityContext.getSupportFragmentManager();
    fragmentTransaction = fragmentManager.beginTransaction();
    SurveyOverView surveyOverView = new SurveyOverView();
    Bundle bundle = new Bundle();
    bundle.putParcelable("SURVEY_QUESTION",surveys.get(position));
    surveyOverView.setArguments(bundle);      fragmentTransaction.replace(R.id.fragment_container,surveyOverView,FRAG_TAG);
    fragmentTransaction.addToBackStack(null);

    fragmentTransaction.commit();

请帮助我不知道如何解决这个问题。

此问题最可能的原因是您在没有先清除其当前数据的情况下将数据添加到现有列表。 发布您的代码以获取更多详细信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM