Handeling事件嵌套片段

时间:2017-05-25 04:33:05

标签: android android-fragments fragment

这是我的问题,我从第一个片段的Gridview项目点击打开了一个新的碎片。在我的第一个片段中刷新网格视图的项目。我已经实现了swipetoRefresh功能。 但是当我打开第二个片段以在水平滚动视图中显示我的网格项目时。这里也是我刷卡刷新(从上到下交换我的手指)。然后我的第一个片段事件发生。我不希望我的第一个片段事件在第二个片段上。请让我知道如何解决它。

下面是我打开新片段的代码。

     Fragment newFragment = new SwipeFragment(featureArr, dataList, HomeFragment.this);

       // Log.e("position clicked is","-----"+position);
        Bundle b = new Bundle();
        b.putInt("pos", position);
        newFragment.setArguments(b);

        FragmentTransaction transaction = ((AppCompatActivity)mContext).getSupportFragmentManager().beginTransaction();

        transaction.add(R.id.frame_edit, newFragment);
        transaction.addToBackStack(null);
// Commit the transaction
        transaction.commit();

0 个答案:

没有答案