本文整理汇总了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;
}