在替换之前检查在framelayout中加载了哪个片段

问题描述 投票:1回答:1

是否可以在添加片段之前检查片段是否已加载到FrameLayout中?

android android-fragments android-framelayout fragmenttransaction
1个回答
1
投票
Fragment a = getSupportFragmentManager().findFragmentById(R.id.FrameLayout);

if(a == null)
    FrameLayout is empty
© www.soinside.com 2019 - 2024. All rights reserved.