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

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

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

ImageButton.setTranslationX介绍

暂无

代码示例

代码示例来源: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.setTranslationX(0);
buttonNext.setTranslationY(0);
updateButtonNextDrawable();
  boolean rtl = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && getResources().getConfiguration().getLayoutDirection() ==
      View.LAYOUT_DIRECTION_RTL;
  buttonSkip.setTranslationX(offset * (rtl ? 1 : -1) * pager.getWidth());
} else {
  buttonSkip.setTranslationX(0);
  boolean rtl = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && getResources().getConfiguration().getLayoutDirection() ==
      View.LAYOUT_DIRECTION_RTL;
  buttonSkip.setTranslationX((rtl ? 1 : -1) * pager.getWidth());
} else {
  buttonSkip.setTranslationY(offset * 2 * buttonNext.getHeight());

相关文章

ImageButton类方法