本文整理了Java中androidx.fragment.app.Fragment.setMenuVisibility()
方法的一些代码示例,展示了Fragment.setMenuVisibility()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fragment.setMenuVisibility()
方法的具体详情如下:
包路径:androidx.fragment.app.Fragment
类名称:Fragment
方法名:setMenuVisibility
暂无
代码示例来源:origin: AlexMofer/ProjectX
@Override
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
Fragment fragment = (Fragment) object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
mCurrentPrimaryItem.setMenuVisibility(false);
mCurrentPrimaryItem.setUserVisibleHint(false);
}
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
mCurrentPrimaryItem = fragment;
}
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object)
{
Fragment f = (Fragment)object;
if (f == currentPrimaryItem)
return;
if (currentPrimaryItem != null) {
currentPrimaryItem.setMenuVisibility(false);
currentPrimaryItem.setUserVisibleHint(false);
}
f.setMenuVisibility(true);
f.setUserVisibleHint(true);
currentPrimaryItem = f;
}
代码示例来源:origin: AlexMofer/ProjectX
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
if (state != null) {
Bundle bundle = (Bundle) state;
bundle.setClassLoader(loader);
Parcelable[] fss = bundle.getParcelableArray("states");
mSavedState.clear();
if (fss != null) {
for (Parcelable fs : fss) {
mSavedState.add((Fragment.SavedState) fs);
}
}
Iterable<String> keys = bundle.keySet();
for (String key : keys) {
if (key.startsWith("f")) {
Fragment f = mFragmentManager.getFragment(bundle, key);
if (f != null) {
f.setMenuVisibility(false);
} else {
Log.w(TAG, "Bad fragment at key " + key);
}
}
}
}
}
代码示例来源:origin: AlexMofer/ProjectX
fragment.setMenuVisibility(false);
fragment.setUserVisibleHint(false);
代码示例来源:origin: proninyaroslav/libretorrent
@NonNull
@Override
public Object instantiateItem(ViewGroup container, int position)
{
if (position < 0 || position >= getCount())
return null;
if (curTransaction == null)
curTransaction = fm.beginTransaction();
String name = makeFragmentName(container.getId(), position);
Fragment f = fm.findFragmentByTag(name);
if (f != null) {
curTransaction.attach(f);
} else {
f = getItem(position);
curTransaction.add(container.getId(), f,
makeFragmentName(container.getId(), position));
}
if (f != currentPrimaryItem) {
f.setMenuVisibility(false);
f.setUserVisibleHint(false);
}
registeredFragments.put(position, f);
return f;
}
内容来源于网络,如有侵权,请联系作者删除!