本文整理匯總了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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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();
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例14: DepthFragmentState
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public DepthFragmentState(Fragment fragment) {
this.fragmentReference = new WeakReference<>(fragment);
this.isReady = fragment.getView() != null;
}