当前位置: 首页>>代码示例>>Java>>正文


Java Fragment.setMenuVisibility方法代码示例

本文整理汇总了Java中android.app.Fragment.setMenuVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.setMenuVisibility方法的具体用法?Java Fragment.setMenuVisibility怎么用?Java Fragment.setMenuVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Fragment的用法示例。


在下文中一共展示了Fragment.setMenuVisibility方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPrimaryItem

import android.app.Fragment; //导入方法依赖的package包/类
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object)
{
    Fragment fragment = (Fragment) object;
    if (fragment != mCurrentPrimaryItem)
    {
        if (mCurrentPrimaryItem != null)
        {
            mCurrentPrimaryItem.setMenuVisibility(false);
            mCurrentPrimaryItem.setUserVisibleHint(false);
        }
        if (fragment != null)
        {
            fragment.setMenuVisibility(true);
            fragment.setUserVisibleHint(true);
        }
        mCurrentPrimaryItem = fragment;
    }
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:20,代码来源:HueFragmentPagerAdapter.java

示例2: instantiateItem

import android.app.Fragment; //导入方法依赖的package包/类
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
    if (currentTransaction == null)
        currentTransaction = fragmentManager.beginTransaction();

    final String tag = (position == 0) ? TAG_LEFT : TAG_RIGHT;
    final Fragment fragment = (position == 0) ? left : right;
    currentTransaction.add(container.getId(), fragment, tag);

    if (fragment != currentPrimaryItem) {
        fragment.setMenuVisibility(false);
        fragment.setUserVisibleHint(false);
    }

    return fragment;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:17,代码来源:AddressBookActivity.java

示例3: instantiateItem

import android.app.Fragment; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position)
{
    if (mCurTransaction == null)
    {
        mCurTransaction = mFragmentManager.beginTransaction();
    }
    final long itemId = getItemId(position);
    // Do we already have this fragment?
    String name = makeFragmentName(container.getId(), itemId);
    Fragment fragment = mFragmentManager.findFragmentByTag(name);
    if (fragment != null)
    {
        if (DEBUG)
        {
            Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
        }
        mCurTransaction.attach(fragment);
    }
    else
    {
        fragment = getItem(position);
        if (DEBUG)
        {
            Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
        }
        mCurTransaction.add(container.getId(), fragment,
                makeFragmentName(container.getId(), itemId));
    }
    if (fragment != mCurrentPrimaryItem)
    {
        fragment.setMenuVisibility(false);
        fragment.setUserVisibleHint(false);
    }
    return fragment;
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:37,代码来源:HueFragmentPagerAdapter.java

示例4: instantiateItem

import android.app.Fragment; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (currTransaction == null) {
        currTransaction = fm.beginTransaction();
    }

    Fragment fragment = getExistingFragment(position);

    if (fragment != null) {
        retentionStrategy.attach(fragment, currTransaction);
    } else {
        fragment = createFragment(entries.get(position).getDescriptor());
        currTransaction.add(container.getId(), fragment,
                getFragmentTag(position));
    }

    if (fragment != currPrimaryItem) {
        fragment.setMenuVisibility(false);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            fragment.setUserVisibleHint(false);
        }
    }

    return (fragment);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:28,代码来源:ArrayPagerAdapter.java

示例5: setPrimaryItem

import android.app.Fragment; //导入方法依赖的package包/类
@Override
public void setPrimaryItem(final ViewGroup container, final int position, final Object object) {
    final Fragment fragment = (Fragment) object;
    if (fragment != currentPrimaryItem) {
        if (currentPrimaryItem != null) {
            currentPrimaryItem.setMenuVisibility(false);
            currentPrimaryItem.setUserVisibleHint(false);
        }
        if (fragment != null) {
            fragment.setMenuVisibility(true);
            fragment.setUserVisibleHint(true);
        }
        currentPrimaryItem = fragment;
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:16,代码来源:AddressBookActivity.java


注:本文中的android.app.Fragment.setMenuVisibility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。