本文整理汇总了Java中android.support.v4.view.ViewCompat.setChildrenDrawingOrderEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.setChildrenDrawingOrderEnabled方法的具体用法?Java ViewCompat.setChildrenDrawingOrderEnabled怎么用?Java ViewCompat.setChildrenDrawingOrderEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.setChildrenDrawingOrderEnabled方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PullRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public PullRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
int defaultDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);
mDurationToStartPosition = defaultDuration;
mDurationToCorrectPosition = defaultDuration;
mSpinnerFinalOffset = mTotalDragDistance = dp2px(DRAG_MAX_DISTANCE);
mRefreshView = new ImageView(context);
setRefreshDrawable(new PlaneDrawable(getContext(), this));
mRefreshView.setVisibility(GONE);
addView(mRefreshView, 0);
mLoadView = new ImageView(context);
setLoadDrawable(new PlaneLoadDrawable(getContext(), this));
mLoadView.setVisibility(GONE);
addView(mLoadView, 0);
setWillNotDraw(false);
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
示例2: LingjuSwipeUpLoadRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Constructor that is called when inflating SwipeRefreshLayout from XML.
*
* @param context
* @param attrs
*/
public LingjuSwipeUpLoadRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
createProgressView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
// the absolute offset has to take into account that the circle starts at an offset
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
}
示例3: TypewriterRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Constructor that is called when inflating {@link TypewriterRefreshLayout} from XML.
*
* @param context
* @param attrs
*/
public TypewriterRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
if (getChildCount() > 1) {
throw new RuntimeException("You can attach only one child to the TypewriterRefreshLayout!");
}
touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
refreshView = new ImageView(context);
totalDragDistance = Utils.convertDpToPixel(context, MAX_DRAG_DISTANCE);
refreshDrawable = new TypewriterRefreshDrawable(this);
refreshView.setImageDrawable(refreshDrawable);
addView(refreshView);
setWillNotDraw(false);
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
示例4: SwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Constructor that is called when inflating SwipeRefreshLayout from XML.
*
* @param context
* @param attrs
*/
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
createProgressView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
// the absolute offset has to take into account that the circle starts at an offset
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
requestDisallowInterceptTouchEvent(true);
}
示例5: ProgressLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
createProgressView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
// the absolute offset has to take into account that the circle starts at an offset
}
示例6: SuperSwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
/**
* getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
*/
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(
DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context
.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mHeaderViewWidth = (int) display.getWidth();
mFooterViewWidth = (int) display.getWidth();
mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
mFooterViewHeight = (int) (FOOTER_VIEW_HEIGHT * metrics.density);
defaultProgressView = new CircleProgressView(getContext());
createHeaderViewContainer();
createFooterViewContainer();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
density = metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
}
示例7: SuperSwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
/**
* getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
*/
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(
DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context
.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mHeaderViewWidth = (int) display.getWidth();
mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
createHeaderViewContainer();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
density = metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
}
示例8: SwipeToRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public SwipeToRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(2f);
// 默认下拉刷新
mType = SwipeToRefreshLayoutType.TOP;
mBothType = false;
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mCircleLoadingSize = (int) (40 * metrics.density);
initLoadingView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mSpinnerFinalOffset = 64 * metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
}
示例9: SuperSwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
/**
* getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
*/
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(
DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context
.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mHeaderViewWidth = (int) display.getWidth();
mFooterViewWidth = (int) display.getWidth();
mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
mFooterViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
defaultProgressView = new CircleProgressView(getContext());
createHeaderViewContainer();
createFooterViewContainer();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
density = metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
}
示例10: ISwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Constructor that is called when inflating ISwipeRefreshLayout from XML.
*
* @param context
* @param attrs
*/
public ISwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mRefreshViewHeight = (int) (DEFAULT_HEADER_HEIGHT * metrics.density);
HEADER_VIEW_MIN_HEIGHT = mRefreshViewHeight;
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mTotalDragDistance = (int) (DEFAULT_HEADER_TARGET * metrics.density);
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
//add default refreshview
setRefreshHeaderView(new ClassicIRefreshHeaderView(getContext()));
}
示例11: RCTSwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Simple constructor to use when creating a SwipeRefreshLayout from code.
*
* @param context
*/
public RCTSwipeRefreshLayout(Context context) {
this(context, null);
DisplayMetrics dm = new DisplayMetrics();
density = context.getResources().getDisplayMetrics().density;
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
// the absolute offset has to take into account that the circle starts at an offset
final DisplayMetrics metrics = getResources().getDisplayMetrics();
setNestedScrollingEnabled(true);
}
开发者ID:React-Native-Library,项目名称:react-native-pull-up-down-refresh,代码行数:18,代码来源:RCTSwipeRefreshLayout.java
示例12: QMUIPullRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public QMUIPullRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setWillNotDraw(false);
final ViewConfiguration vc = ViewConfiguration.get(context);
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMiniVelocity = vc.getScaledMinimumFlingVelocity();
mSystemTouchSlop = vc.getScaledTouchSlop();
mTouchSlop = QMUIDisplayHelper.px2dp(context, mSystemTouchSlop); //系统的值是8dp,如何配置?
mScroller = new Scroller(getContext());
mScroller.setFriction(getScrollerFriction());
addRefreshView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
TypedArray array = context.obtainStyledAttributes(attrs,
R.styleable.QMUIPullRefreshLayout, defStyleAttr, 0);
try {
mRefreshInitOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_refresh_init_offset, Integer.MIN_VALUE);
mRefreshEndOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_refresh_end_offset, Integer.MIN_VALUE);
mTargetInitOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_target_init_offset, 0);
mTargetRefreshOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_target_refresh_offset,
QMUIDisplayHelper.dp2px(getContext(), 72));
mAutoCalculateRefreshInitOffset = mRefreshInitOffset == Integer.MIN_VALUE ||
array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_auto_calculate_refresh_init_offset, false);
mAutoCalculateRefreshEndOffset = mRefreshEndOffset == Integer.MIN_VALUE ||
array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_auto_calculate_refresh_end_offset, false);
mEqualTargetRefreshOffsetToRefreshViewHeight = array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_equal_target_refresh_offset_to_refresh_view_height, false);
} finally {
array.recycle();
}
mRefreshCurrentOffset = mRefreshInitOffset;
mTargetCurrentOffset = mTargetInitOffset;
}
示例13: SwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Constructor that is called when inflating SwipeRefreshLayout from XML.
*
* @param context
* @param attrs
*/
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
final TypedArray a2 = context.obtainStyledAttributes(attrs, R.styleable.SwipeRefreshLayout);
SwipeRefreshLayoutDirection direction
= SwipeRefreshLayoutDirection.getFromInt(a2.getInt(R.styleable.SwipeRefreshLayout_direction, 0));
if (direction != SwipeRefreshLayoutDirection.BOTH) {
mDirection = direction;
mBothDirection = false;
} else {
mDirection = SwipeRefreshLayoutDirection.TOP;
mBothDirection = true;
}
a2.recycle();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
createProgressView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
// the absolute offset has to take into account that the circle starts at an offset
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
//设置刷新动画颜色
setColorSchemeResources(
android.R.color.holo_blue_light,
android.R.color.holo_red_light,
android.R.color.holo_orange_light,
android.R.color.holo_green_light);
}
示例14: SuperSwipeRefreshLayout
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
/**
* getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
*/
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMediumAnimationDuration = getResources().getInteger(
android.R.integer.config_mediumAnimTime);
setWillNotDraw(false);
mDecelerateInterpolator = new DecelerateInterpolator(
DECELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context
.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
setEnabled(a.getBoolean(0, true));
a.recycle();
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
final DisplayMetrics metrics = getResources().getDisplayMetrics();
mHeaderViewWidth = (int) display.getWidth();
mFooterViewWidth = (int) display.getWidth();
mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
mFooterViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
defaultProgressView = new CircleProgressView(getContext());
createHeaderViewContainer();
createFooterViewContainer();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
density = metrics.density;
mTotalDragDistance = mSpinnerFinalOffset;
}