android.support.v4.view.ViewCompat#getX ( )源码实例Demo

下面列出了android.support.v4.view.ViewCompat#getX ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Dragger   文件: DraggerView.java
/**
 * Detect if the dragView actual position is above the
 * limit determined with the @param dragLimit.
 *
 * @return Use a dimension and compare with the dragged
 * axis position.
 */
boolean isDragViewAboveTheLimit() {
  int parentSize;
  float viewAxisPosition;
  switch (dragPosition) {
    case LEFT:
      parentSize = dragView.getWidth();
      viewAxisPosition = -ViewCompat.getX(dragView) + (parentSize * dragLimit);
      break;
    case RIGHT:
      parentSize = dragView.getWidth();
      viewAxisPosition = ViewCompat.getX(dragView) + (parentSize * dragLimit);
      break;
    case TOP:
    default:
      parentSize = dragView.getHeight();
      viewAxisPosition = ViewCompat.getY(dragView) + (parentSize * dragLimit);
      break;
    case BOTTOM:
      parentSize = dragView.getHeight();
      viewAxisPosition = -ViewCompat.getY(dragView) + (parentSize * dragLimit);
      break;
  }
  return parentSize < viewAxisPosition;
}
 
源代码2 项目: Tok-Android   文件: ViewUtil.java
public static float getX(final @NonNull View v) {
    if (Build.VERSION.SDK_INT >= 11) {
        return ViewCompat.getX(v);
    } else {
        return ((LinearLayout.LayoutParams) v.getLayoutParams()).leftMargin;
    }
}
 
源代码3 项目: Silence   文件: ViewUtil.java
public static float getX(final @NonNull View v) {
  if (VERSION.SDK_INT >= 11) {
    return ViewCompat.getX(v);
  } else {
    return ((LayoutParams)v.getLayoutParams()).leftMargin;
  }
}
 
源代码4 项目: android-md-core   文件: FabSheetWindow.java
FabInfo(FloatingActionButton fab) {
  int[] location = new int[2];
  fab.getLocationInWindow(location);

  width = fab.getMeasuredWidth();
  height = fab.getMeasuredHeight();
  topLeft = new Pointer(location[0], location[1]);
  center = new Pointer(topLeft.x + width / 2, topLeft.y + height / 2);
  bottomRight = new Pointer(topLeft.x + width, topLeft.y + height);
  relativeTopLeft = new Pointer(ViewCompat.getX(fab), ViewCompat.getY(fab));
  relativeCenter = new Pointer(relativeTopLeft.x + width / 2, relativeTopLeft.y + height / 2);
  relativeBottomRight = new Pointer(relativeTopLeft.x + width, relativeTopLeft.y + height);
  radius = Math.min(width / 2, MdCompat.dpToPx(FAB_SIZE));
}
 
源代码5 项目: Expert-Android-Programming   文件: ViewUtils.java
public static float centerX(View view) {
    return ViewCompat.getX(view) + view.getWidth() / 2f;
}
 
源代码6 项目: HaiNaBaiChuan   文件: SheetLayout.java
private float centerX(View view) {
    return ViewCompat.getX(view) + view.getWidth() / 2f;
}
 
源代码7 项目: android-md-core   文件: Utils.java
public static float centerX(View view) {
  return ViewCompat.getX(view) + view.getMeasuredWidth() / 2;
}
 
 同类方法