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


Java Fragment.getView方法代码示例

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


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

示例1: onUpOrCancelMotionEvent

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void onUpOrCancelMotionEvent(final ObservableScrollState scrollState) {
    if (!mScrolled) {
        // This event can be used only when TouchInterceptionFrameLayout
        // doesn't handle the consecutive events.
        // toolbarAdjustment(scrollState);
        mBaseTranslationY = 0;

        final Fragment fragment = getCurrentFragment();
        if (fragment == null) {
            return;
        }
        View view = fragment.getView();
        if (view == null) {
            return;
        }
        //    toolbarAdjustment(mLastScrollState, view);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ViewPagerTabFragmentParentFragment.java

示例2: findContainerById

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private ViewGroup findContainerById(Fragment fragment, int containerId) {
    if (fragment.getView() == null) return null;

    View container;
    Fragment parentFragment = fragment.getParentFragment();
    if (parentFragment != null) {
        if (parentFragment.getView() != null) {
            container = parentFragment.getView().findViewById(containerId);
        } else {
            container = findContainerById(parentFragment, containerId);
        }
    } else {
        container = mActivity.findViewById(containerId);
    }

    if (container instanceof ViewGroup) {
        return (ViewGroup) container;
    }

    return null;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:22,代码来源:TransactionDelegate.java

示例3: findAllSupportFragmentsWithViews

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private static void findAllSupportFragmentsWithViews(
    @Nullable Collection<Fragment> topLevelFragments,
    Map<View, Fragment> result) {
  if (topLevelFragments == null) {
    return;
  }
  for (Fragment fragment : topLevelFragments) {
    // getFragment()s in the support FragmentManager may contain null values, see #1991.
    if (fragment == null || fragment.getView() == null) {
      continue;
    }
    result.put(fragment.getView(), fragment);
    findAllSupportFragmentsWithViews(fragment.getChildFragmentManager().getFragments(), result);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RequestManagerRetriever.java

示例4: instantiateItem

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
    Fragment f = (Fragment) super.instantiateItem(container, position);
    View view = f.getView();
    if (view != null)
        container.addView(view);
    return f;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:AdapterViewPager.java

示例5: removeToDetachFragment

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private Fragment removeToDetachFragment(StateChange stateChange, Path key) {
    Fragment fragment = fragmentManager.findFragmentByTag(key.getFragmentTag());
    if(fragment != null && (fragment.isDetached() || fragment.getView() == null)) {
        FragmentTransaction fragmentTransaction = beginFragmentTransaction(stateChange);
        Fragment.SavedState savedState = fragmentManager.saveFragmentInstanceState(fragment);
        fragmentTransaction.remove(fragment);
        fragmentTransaction.commitNow();
        fragment.setInitialSavedState(savedState);
    }
    return fragment;
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:12,代码来源:MasterDetailFragmentStateChanger.java

示例6: setBackgroundColor

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 设置背景色
 *
 * @param fragment fragment
 * @param color    背景色
 */
public static void setBackgroundColor(@NonNull final Fragment fragment, @ColorInt final int color) {
    View view = fragment.getView();
    if (view != null) {
        view.setBackgroundColor(color);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:FragmentUtils.java

示例7: setBackground

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Set the background
 *
 * @param fragment   fragment
 * @param background background
 */
public static void setBackground(@NonNull Fragment fragment, Drawable background) {
    View view = fragment.getView();
    if (view != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.setBackground(background);
        } else {
            view.setBackgroundDrawable(background);
        }
    }
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:17,代码来源:FragmentUtils.java

示例8: handleStateChange

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void handleStateChange(@NonNull final StateChange stateChange, @NonNull StateChanger.Callback callback) {
    masterDetailFragmentStateChanger.handleStateChange(stateChange);
    FragmentManager fragmentManager = FragmentManagerService.get(getContext());
    Fragment fragment = fragmentManager.findFragmentById(R.id.master);
    if(fragment != null && fragment.getView() != null && fragment.getView() instanceof IsMasterView) {
        ((IsMasterView) fragment.getView()).updateSelection(stateChange.<MasterDetailPath>topNewState());
    }
    callback.stateChangeComplete();
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:11,代码来源:TabletMasterDetailRoot.java

示例9: setBackgroundResource

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 设置背景资源
 *
 * @param fragment fragment
 * @param resId    资源Id
 */
public static void setBackgroundResource(@NonNull Fragment fragment, @DrawableRes int resId) {
    View view = fragment.getView();
    if (view != null) {
        view.setBackgroundResource(resId);
    }
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:13,代码来源:FragmentUtils.java

示例10: setBackground

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 设置背景
 *
 * @param fragment   fragment
 * @param background 背景
 */
public static void setBackground(@NonNull Fragment fragment, Drawable background) {
    View view = fragment.getView();
    if (view != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.setBackground(background);
        } else {
            view.setBackgroundDrawable(background);
        }
    }
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:17,代码来源:FragmentUtils.java

示例11: setBackgroundColor

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 设置背景色
 *
 * @param fragment fragment
 * @param color    背景色
 */
public static void setBackgroundColor(@NonNull Fragment fragment, @ColorInt int color) {
    View view = fragment.getView();
    if (view != null) {
        view.setBackgroundColor(color);
    }
}
 
开发者ID:yangxp108,项目名称:MVPArms_Fragment-fragment,代码行数:13,代码来源:FragmentUtils.java

示例12: tryCaptureView

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public boolean tryCaptureView(View child, int pointerId) {
    boolean dragEnable = mHelper.isEdgeTouched(mEdgeFlag, pointerId);
    if (dragEnable) {
        if (mHelper.isEdgeTouched(EDGE_LEFT, pointerId)) {
            mCurrentSwipeOrientation = EDGE_LEFT;
        } else if (mHelper.isEdgeTouched(EDGE_RIGHT, pointerId)) {
            mCurrentSwipeOrientation = EDGE_RIGHT;
        }

        if (mListeners != null && !mListeners.isEmpty()) {
            for (OnSwipeListener listener : mListeners) {
                listener.onEdgeTouch(mCurrentSwipeOrientation);
            }
        }

        if (mPreFragment == null) {
            if (mFragment != null) {
                List<Fragment> fragmentList = FragmentationHack.getActiveFragments(((Fragment) mFragment).getFragmentManager());
                if (fragmentList != null && fragmentList.size() > 1) {
                    int index = fragmentList.indexOf(mFragment);
                    for (int i = index - 1; i >= 0; i--) {
                        Fragment fragment = fragmentList.get(i);
                        if (fragment != null && fragment.getView() != null) {
                            fragment.getView().setVisibility(VISIBLE);
                            mPreFragment = fragment;
                            break;
                        }
                    }
                }
            }
        } else {
            View preView = mPreFragment.getView();
            if (preView != null && preView.getVisibility() != VISIBLE) {
                preView.setVisibility(VISIBLE);
            }
        }
    }
    return dragEnable;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:41,代码来源:SwipeBackLayout.java

示例13: setBackgroundResource

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Set background resources
 *
 * @param fragment fragment
 * @param resId    Resource Id
 */
public static void setBackgroundResource(@NonNull Fragment fragment, @DrawableRes int resId) {
    View view = fragment.getView();
    if (view != null) {
        view.setBackgroundResource(resId);
    }
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:13,代码来源:FragmentUtils.java

示例14: DepthFragmentState

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public DepthFragmentState(Fragment fragment) {
    this.fragmentReference = new WeakReference<>(fragment);
    this.isReady = fragment.getView() != null;
}
 
开发者ID:florent37,项目名称:Depth,代码行数:5,代码来源:DepthFragmentState.java


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