android.widget.ImageView.setX()方法的使用及代码示例

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

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

ImageView.setX介绍

暂无

代码示例

代码示例来源:origin: brianwernick/ExoMedia

@Override
public void onAnimationEnd(Animation animation) {
  rippleIndicator.setX(rippleIndicator.getX() + xDelta);
  rippleIndicator.clearAnimation();
}

代码示例来源:origin: westnordost/StreetComplete

private void showMarkerSolvedAnimation(@DrawableRes int iconResId, PointF startScreenPos, String source)
{
  soundFx.play(getResources().getIdentifier("plop"+random.nextInt(4), "raw", getPackageName()));
  ViewGroup root = (ViewGroup) getWindow().getDecorView();
  ImageView img = (ImageView) getLayoutInflater().inflate(R.layout.effect_quest_plop, root, false);
  img.setX(startScreenPos.x);
  img.setY(startScreenPos.y);
  img.setImageResource(iconResId);
  root.addView(img);
  flingQuestMarkerTo(img, answersCounter.getAnswerTarget(), () -> {
    root.removeView(img);
    answersCounter.addOneUnsynced(source);
  });
}

代码示例来源:origin: stackoverflow.com

mToolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
   @Override
   public void onGlobalLayout() {
     ImageView imageView = (ImageView)mToolbar.findViewById(R.id.logo);
     if( mToolbar == null ){
       return;
     }
     int toolbarWidth = mToolbar.getWidth();
     int imageWidth = imageView.getWidth();
     imageView.setX((toolbarWidth-imageWidth)/2);
   }
 });

代码示例来源:origin: stackoverflow.com

mToolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
   @Override
   public void onGlobalLayout() {
     ImageView imageView = (ImageView)mToolbar.findViewById(R.id.logo);
     if( mToolbar == null ){
       return;
     }
     int toolbarWidth = mToolbar.getWidth();
     int imageWidth = imageView.getWidth();
     imageView.setX((toolbarWidth-imageWidth)/2);
   }
 });

代码示例来源:origin: yydcdut/SlideAndDragListView

@Override
public void onDragMoving(int x, int y, View view, SlideAndDragListView.OnDragDropListener listener) {
  mDragView.setX(mLeftAndTopOffset[0]);
  mDragView.setY(y - mDragDelta + mLeftAndTopOffset[1]);
}

代码示例来源:origin: stackoverflow.com

ImageView iv = new ImageView(super.getContext());
iv.setImageResource(R.drawable.image);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
this.addView(iv, params);
iv.setX(259);
iv.setY(100);

代码示例来源:origin: Solartisan/DragDropListView

@Override
public void onDragHovered(int x, int y, View tileView) {
  // Update the drag shadow location.
  mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
  mDragShadowLeft = x - mTouchOffsetToChildLeft - mLocationOnScreen[0];
  mDragShadowTop = y - mTouchOffsetToChildTop - mLocationOnScreen[1];
  // Draw the drag shadow at its last known location if the drag shadow exists.
  if (mDragShadowOverlay != null) {
    mDragShadowOverlay.setX(mDragShadowLeft);
    mDragShadowOverlay.setY(mDragShadowTop);
  }
}

代码示例来源:origin: KishanV/Android-Music-Player

@Override
public void onMove(MotionEvent event) {
  super.onMove(event);
  Vx.addMovement(event);
  top.setX(event.getX() - DX);
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void onDragHovered(int x, int y, PhoneFavoriteSquareTileView tileView) {
  // Update the drag shadow location.
  mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
  mDragShadowLeft = x - mTouchOffsetToChildLeft - mLocationOnScreen[0];
  mDragShadowTop = y - mTouchOffsetToChildTop - mLocationOnScreen[1];
  // Draw the drag shadow at its last known location if the drag shadow exists.
  if (mDragShadowOverlay != null) {
    mDragShadowOverlay.setX(mDragShadowLeft);
    mDragShadowOverlay.setY(mDragShadowTop);
  }
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override  
  public void onAnimationUpdate(ValueAnimator animation)  
  {  
    PointF point = (PointF) animation.getAnimatedValue();  
    button2.setX(point.x);  
    button2.setY(point.y);  
  }  
});

代码示例来源:origin: XingdongYu/QQNaviView

@Override
public boolean performClick() {
  mCheckStatus = CHECKED;
  // 考虑点击状态是 unchecked -> checked的情况,此时会开始转向动画,
  // 但我们希望的是icon都是正常状态,因此这里removeCallback,并将smallIcon重置为0
  mHandler.removeCallbacks(mRunnable);
  mSmallIcon.setX(0);
  // 重置方向
  mDirection = -1;
  return super.performClick();
}

代码示例来源:origin: xuhongv/SmartHome

public BubbleView setGiftBoxImaeg(Drawable drawable, int positionX, int positionY) {
  ImageView imageView = new ImageView(this.getContext());
  imageView.setImageDrawable(drawable);
  LayoutParams layoutParams = new LayoutParams(imageView.getWidth(), imageView.getHeight());
  this.addView(imageView, layoutParams);
  imageView.setX((float)positionX);
  imageView.setY((float)positionY);
  return this;
}

代码示例来源:origin: safetysystemtechnology/audio-recorder-button

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    float x = (Float) animation.getAnimatedValue();
    mImageView.setX(x);
    if (mImageView.getX() > DEFAULT_REMOVE_ICON_SIZE){
      unRevealSizeToRemove();
    }
  }
});

代码示例来源:origin: mohak1712/SignUpLogin

@Override
  public void run() {
    logo.setX((relativeLayout2.getRight() / 2));
    logo.setY(inDp(50));
    mainFrame.addView(logo);
  }
});

代码示例来源:origin: githubliruiyuan/Animation

private void pageOneStop(){
  page_one_center_tj.setVisibility(View.INVISIBLE);
  page_one_planeline.setVisibility(View.INVISIBLE);
  page_one_text.setVisibility(View.INVISIBLE);
  animationTop.cancel();
  animationLeftcloud.cancel();
  animationRightcloud.cancel();
  if (null != animationRocket)
    animationRocket.cancel();
  page_one_rocket.setX(rocketX);
  page_one_rocket.setY(rocketY);
}

代码示例来源:origin: skydoves/ColorPickerView

/**
 * changes selector's selected point without notifies.
 *
 * @param x coordinate x of the selector.
 * @param y coordinate y of the selector.
 */
public void setCoordinate(int x, int y) {
  selector.setX(x - (selector.getMeasuredWidth() / 2));
  selector.setY(y - (selector.getMeasuredHeight() / 2));
}

代码示例来源:origin: skydoves/ColorPickerView

public void updateSelectorX(int x) {
  float left = selector.getMeasuredWidth();
  float right = getMeasuredWidth() - selector.getMeasuredWidth();
  selectorPosition = (x - left) / (right - left);
  selector.setX(x - (selector.getMeasuredWidth() / 2));
  selectedX = x;
  int maxPos = getMeasuredWidth() - selector.getMeasuredWidth();
  if (selector.getX() >= maxPos) selector.setX(maxPos);
  if (selector.getX() <= 0) selector.setX(0);
  colorPickerView.fireColorListener(assembleColor(), false);
}

代码示例来源:origin: skydoves/ColorPickerPreference

public void setSelectorPoint(int x, int y) {
 selector.setX(x - getSelectorHalfWidth());
 selector.setY(y - getSelectorHalfHeight());
 selectedPoint = new Point(x, y);
 lastSelectedColor = getColorFromBitmap(x, y);
 fireColorListener();
 handleFlagView(new Point(x - getSelectorHalfWidth(), y - getSelectorHalfHeight()));
}

代码示例来源:origin: skydoves/ColorPickerView

@Override
public void onInflateFinished() {
  int defaultPosition = getMeasuredWidth() - selector.getMeasuredWidth();
  if (getPreferenceName() != null) {
    updateSelectorX(
        ColorPickerPreferenceManager.getInstance(getContext())
            .getBrightnessSliderPosition(getPreferenceName(), defaultPosition));
  } else {
    selector.setX(defaultPosition);
  }
}

代码示例来源:origin: skydoves/ColorPickerView

@Override
public void onInflateFinished() {
  int defaultPosition = getMeasuredWidth() - selector.getMeasuredWidth();
  if (getPreferenceName() != null) {
    updateSelectorX(
        ColorPickerPreferenceManager.getInstance(getContext())
            .getAlphaSliderPosition(getPreferenceName(), defaultPosition));
  } else {
    selector.setX(defaultPosition);
  }
}

相关文章

ImageView类方法