當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。