android.view.View.getZ()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中android.view.View.getZ()方法的一些代码示例,展示了View.getZ()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.getZ()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:getZ

View.getZ介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

@TargetApi(LOLLIPOP)
public S hasZ(float z) {
 isNotNull();
 float actualZ = actual.getZ();
 assertThat(actualZ) //
   .overridingErrorMessage("Expected z <%s> but was <%s>", z, actualZ) //
   .isEqualTo(z);
 return myself;
}

代码示例来源:origin: plusCubed/anticipate

private void captureValues(TransitionValues values) {
  View view = values.view;
  if (view.isLaidOut() || view.getWidth() != 0 || view.getHeight() != 0) {
    values.values.put(PROPNAME_ELEVATION, view.getZ());
  }
}

代码示例来源:origin: zj565061763/switchbutton

/**
 * 找到parent中处于指定坐标下最顶部的child(Z值最大,最后面添加)
 *
 * @param parent
 * @param x
 * @param y
 * @return
 */
public static View findTopChildUnder(ViewGroup parent, int x, int y)
{
  if (Build.VERSION.SDK_INT < 21)
    return parent.getChildAt(parent.getChildCount() - 1);
  final List<View> list = findChildrenUnder(parent, x, y);
  if (list.isEmpty())
    return null;
  View target = null;
  for (View item : list)
  {
    if (target == null)
    {
      target = item;
    } else
    {
      if (item.getZ() > target.getZ())
        target = item;
    }
  }
  return target;
}

代码示例来源:origin: consp1racy/android-support-preference

private void captureValues(@NonNull TransitionValues values) {
  final View view = values.view;
  if (view.getVisibility() == View.GONE) {
    return;
  }
  final Rect bounds = new Rect(0, 0, view.getWidth(), view.getHeight());
  values.values.put(PROPNAME_BOUNDS, bounds);
  values.values.put(PROPNAME_TRANSLATE_X, view.getTranslationX());
  values.values.put(PROPNAME_TRANSLATE_Y, view.getTranslationY());
  values.values.put(PROPNAME_TRANSLATE_Z, view.getTranslationZ());
  values.values.put(PROPNAME_Z, view.getZ());
  final Rect clip = view.getClipBounds();
  values.values.put(PROPNAME_CLIP, clip);
}

代码示例来源:origin: com.squareup.assertj/assertj-android

@TargetApi(LOLLIPOP)
public S hasZ(float z) {
 isNotNull();
 float actualZ = actual.getZ();
 assertThat(actualZ) //
   .overridingErrorMessage("Expected z <%s> but was <%s>", z, actualZ) //
   .isEqualTo(z);
 return myself;
}

代码示例来源:origin: googlesamples/android-ElevationDrag

@Override
  public void run() {
    // Check that the view has moved.
    float deltaX = mFloatingShape.getX() - initialX;
    assertTrue(Math.abs(deltaX) > 0f);
    // Check that the view is raised.
    assertTrue(mFloatingShape.getZ() > 0f);
  }
});

代码示例来源:origin: cdflynn/touchdemo

ValueAnimator topAnimator = ValueAnimator.ofFloat(mViews.cardA.getZ(), mElevationLow)
    .setDuration(ELEVATION_ANIMATION_DURATION);
topAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
topAnimator.start();
ValueAnimator bottomAnimator = ValueAnimator.ofFloat(mViews.cardB.getZ(), mElevationHigh)
    .setDuration(ELEVATION_ANIMATION_DURATION);
bottomAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

代码示例来源:origin: googlesamples/android-ElevationBasic

/**
   * Test if the initial Z values of the shapes are correct.
   */
  public void testInitialShapeZ() {
    assertTrue(mShape1.getZ() > 0f);
    assertEquals(mShape2.getZ(), 0f);
  }
}

代码示例来源:origin: jbruchanov/AnUitor

data.put("TransitionName", v.getTransitionName());
data.put("TranslationZ", v.getTranslationZ());
data.put("Z", v.getZ());
data.put("NestedScrollingParent", v.hasNestedScrollingParent());
data.put("StateListAnimator", v.getStateListAnimator());

代码示例来源:origin: googlesamples/android-ElevationDrag

/**
* Test if the test fixture has been set up correctly.
*/
public void testPreconditions() {
  //Try to add a message to add context to your assertions. These messages will be shown if
  //a tests fails and make it easy to understand why a test failed
  assertNotNull("mTestActivity is null", mTestActivity);
  assertNotNull("mTestFragment is null", mTestFragment);
  assertNotNull("mFloatingShape is null", mFloatingShape);
  assertNotNull("mDragFrame is null", mDragFrame);
  // Check that the view is not raised yet.
  assertEquals(mFloatingShape.getZ(), 0f);
}

相关文章

微信公众号

最新文章

更多

View类方法