android.widget.ImageButton.setTranslationY()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(180)

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

ImageButton.setTranslationY介绍

暂无

代码示例

代码示例来源:origin: nickbutcher/plaid

private void showFab() {
  fab.setAlpha(0f);
  fab.setScaleX(0f);
  fab.setScaleY(0f);
  fab.setTranslationY(fab.getHeight() / 2);
  fab.animate()
      .alpha(1f)
      .scaleX(1f)
      .scaleY(1f)
      .translationY(0f)
      .setDuration(300L)
      .setInterpolator(AnimUtils.getLinearOutSlowInInterpolator(this))
      .start();
}

代码示例来源:origin: heinrichreimer/material-intro

private void updateButtonNextPosition() {
  float realPosition = position + positionOffset;
  float yOffset = getResources().getDimensionPixelSize(R.dimen.mi_y_offset);
  if (realPosition < adapter.getCount() - 2) {
    //Reset
    miButtonNext.setTranslationY(0);
  } else if (realPosition < adapter.getCount() - 1) {
    //Reset finish button, hide next icon
    if (buttonNextFunction == BUTTON_NEXT_FUNCTION_NEXT_FINISH) {
      miButtonNext.setTranslationY(0);
    } else {
      miButtonNext.setTranslationY(positionOffset * yOffset);
    }
  } else if (realPosition >= adapter.getCount() - 1) {
    //Hide finish icon, keep next icon hidden
    if (buttonNextFunction == BUTTON_NEXT_FUNCTION_NEXT_FINISH) {
      miButtonNext.setTranslationY(positionOffset * yOffset);
    } else {
      miButtonNext.setTranslationY(-yOffset);
    }
  }
}

代码示例来源:origin: asyl/ArcAnimator

@Override
  public void onClick(View v) {
    if (TextUtils.isEmpty(mDegreeEditor.getText().toString()) ||
        TextUtils.isEmpty(mSideEditor.getText().toString()) ||
        TextUtils.isEmpty(mDurationEditor.getText().toString())) {
      return;
    }
    if (mSideEditor.getText().toString().equals("0")) {
      mSide = Side.RIGHT;
    } else if (mSideEditor.getText().toString().equals("1")) {
      mSide = Side.LEFT;
    } else {
      return;
    }
    mElement.setTranslationX(startX);
    mElement.setTranslationY(startY);
    ArcAnimator arcAnimator = ArcAnimator.createArcAnimator(mElement, mParent, Float.parseFloat(mDegreeEditor.getText().toString()), mSide)
        .setDuration(Integer.parseInt(mDurationEditor.getText().toString()));
    arcAnimator.start();
    mArcDebugView.drawArcAnimator(arcAnimator);
  }
};

代码示例来源:origin: heinrichreimer/material-intro

private void updateButtonBackPosition() {
  float realPosition = position + positionOffset;
  float yOffset = getResources().getDimensionPixelSize(R.dimen.mi_y_offset);
  if (realPosition < 1 && buttonBackFunction == BUTTON_BACK_FUNCTION_BACK) {
    //Hide back button
    miButtonBack.setTranslationY((1 - positionOffset) * yOffset);
  } else if (realPosition < adapter.getCount() - 2) {
    //Reset
    miButtonBack.setTranslationY(0);
    miButtonBack.setTranslationX(0);
  } else if (realPosition < adapter.getCount() - 1) {
    //Scroll away skip button
    if (buttonBackFunction == BUTTON_BACK_FUNCTION_SKIP) {
      boolean rtl = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && getResources().getConfiguration().getLayoutDirection() ==
          View.LAYOUT_DIRECTION_RTL;
      miButtonBack.setTranslationX(positionOffset * (rtl ? 1 : -1) * miPager.getWidth());
    } else {
      miButtonBack.setTranslationX(0);
    }
  } else {
    //Keep skip button scrolled away, hide next button
    if (buttonBackFunction == BUTTON_BACK_FUNCTION_SKIP) {
      boolean rtl = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && getResources().getConfiguration().getLayoutDirection() ==
          View.LAYOUT_DIRECTION_RTL;
      miButtonBack.setTranslationX((rtl ? 1 : -1) * miPager.getWidth());
    } else {
      miButtonBack.setTranslationY(positionOffset * yOffset);
    }
  }
}

代码示例来源:origin: PuffOpenSource/Puff-Android

buttonSkip.setTranslationY(0);
  } else {
    buttonSkip.setTranslationY((1 - offset) * 2 * buttonNext.getHeight());
  buttonSkip.setTranslationY(0);
  buttonSkip.setTranslationX(0);
  buttonNext.setTranslationY(0);
  updateButtonNextDrawable();
} else if (position + positionOffset >= adapter.getCount() - 2 && position + positionOffset < adapter.getCount() - 1) {
    buttonNext.setTranslationY(0);
  } else {
    buttonNext.setTranslationY(offset * 2 * buttonNext.getHeight());
    buttonSkip.setTranslationX((rtl ? 1 : -1) * pager.getWidth());
  } else {
    buttonSkip.setTranslationY(offset * 2 * buttonNext.getHeight());
    buttonNext.setTranslationY(offset * 2 * buttonNext.getHeight());
  } else {
    buttonNext.setTranslationY(-2 * buttonNext.getHeight());

相关文章

ImageButton类方法