本文整理了Java中android.widget.ImageView.getHeight()
方法的一些代码示例,展示了ImageView.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getHeight()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getHeight
暂无
代码示例来源:origin: chrisbanes/PhotoView
private int getImageViewHeight(ImageView imageView) {
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onProvideShadowMetrics(Point shadowSize,
Point shadowTouchPoint) {
shadowSize.set(iv.getWidth()/8, iv.getHeight()/8);
shadowTouchPoint.set(shadowSize.x/2, shadowSize.y/2);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onProvideShadowMetrics(Point shadowSize,
Point shadowTouchPoint) {
shadowSize.set(iv.getWidth()/8, iv.getHeight()/8);
shadowTouchPoint.set(shadowSize.x/2, shadowSize.y/2);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onProvideShadowMetrics(Point shadowSize,
Point shadowTouchPoint) {
shadowSize.set(iv.getWidth()/8, iv.getHeight()/8);
shadowTouchPoint.set(shadowSize.x/2, shadowSize.y/2);
}
代码示例来源:origin: frogermcs/InstaMaterial
private void animateUserProfileHeader() {
vUserProfileRoot.setTranslationY(-vUserProfileRoot.getHeight());
ivUserProfilePhoto.setTranslationY(-ivUserProfilePhoto.getHeight());
vUserDetails.setTranslationY(-vUserDetails.getHeight());
vUserStats.setAlpha(0);
vUserProfileRoot.animate().translationY(0).setDuration(300).setInterpolator(INTERPOLATOR);
ivUserProfilePhoto.animate().translationY(0).setDuration(300).setStartDelay(100).setInterpolator(INTERPOLATOR);
vUserDetails.animate().translationY(0).setDuration(300).setStartDelay(200).setInterpolator(INTERPOLATOR);
vUserStats.animate().alpha(1).setDuration(200).setStartDelay(400).setInterpolator(INTERPOLATOR).start();
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onProvideShadowMetrics(Point shadowSize,
Point shadowTouchPoint) {
shadowSize.set(iv.getWidth()/8, iv.getHeight()/8);
shadowTouchPoint.set(shadowSize.x/2, shadowSize.y/2);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onProvideShadowMetrics(Point shadowSize,
Point shadowTouchPoint) {
shadowSize.set(iv.getWidth()/8, iv.getHeight()/8);
shadowTouchPoint.set(shadowSize.x/2, shadowSize.y/2);
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
public static void animateTransform(@NonNull ImageView imageView, @Nullable Matrix matrix) {
Drawable drawable = imageView.getDrawable();
if (drawable == null) {
return;
}
if (matrix == null || drawable.getIntrinsicWidth() == -1
|| drawable.getIntrinsicHeight() == -1) {
drawable.setBounds(0, 0, imageView.getWidth(), imageView.getHeight());
} else {
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
Matrix drawMatrix = imageView.getImageMatrix();
if (drawMatrix.isIdentity()) {
drawMatrix = new Matrix();
ReflectionUtils.setFieldValue(imageView, FIELD_DRAW_MATRIX, drawMatrix);
}
drawMatrix.set(matrix);
}
imageView.invalidate();
}
代码示例来源:origin: bm-x/PhotoView
public static Info getImageViewInfo(ImageView imgView) {
int[] p = new int[2];
getLocation(imgView, p);
Drawable drawable = imgView.getDrawable();
Matrix matrix = imgView.getImageMatrix();
int width = getDrawableWidth(drawable);
int height = getDrawableHeight(drawable);
RectF imgRect = new RectF(0, 0, width, height);
matrix.mapRect(imgRect);
RectF rect = new RectF(p[0] + imgRect.left, p[1] + imgRect.top, p[0] + imgRect.right, p[1] + imgRect.bottom);
RectF widgetRect = new RectF(0, 0, imgView.getWidth(), imgView.getHeight());
RectF baseRect = new RectF(widgetRect);
PointF screenCenter = new PointF(widgetRect.width() / 2, widgetRect.height() / 2);
return new Info(rect, imgRect, widgetRect, baseRect, screenCenter, 1, 0, imgView.getScaleType());
}
代码示例来源:origin: Hitomis/transferee
public static PhotoInfo getImageViewInfo(ImageView imgView) {
int[] p = new int[2];
getLocation(imgView, p);
Drawable drawable = imgView.getDrawable();
Matrix matrix = imgView.getImageMatrix();
int width = getDrawableWidth(drawable);
int height = getDrawableHeight(drawable);
RectF imgRect = new RectF(0, 0, width, height);
matrix.mapRect(imgRect);
RectF rect = new RectF(p[0] + imgRect.left, p[1] + imgRect.top, p[0] + imgRect.right, p[1] + imgRect.bottom);
RectF widgetRect = new RectF(0, 0, imgView.getWidth(), imgView.getHeight());
RectF baseRect = new RectF(widgetRect);
PointF screenCenter = new PointF(widgetRect.width() / 2, widgetRect.height() / 2);
return new PhotoInfo(rect, imgRect, widgetRect, baseRect, screenCenter, 1, 0, imgView.getScaleType());
}
代码示例来源:origin: wangdan/AisenWeiBo
public final void onFling(float startX, float startY, float velocityX, float velocityY) {
if (DEBUG) {
Log.d(LOG_TAG, "onFling. sX: " + startX + " sY: " + startY + " Vx: " + velocityX + " Vy: " + velocityY);
}
ImageView imageView = getImageView();
if (hasDrawable(imageView)) {
mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
mCurrentFlingRunnable.fling(imageView.getWidth(), imageView.getHeight(), (int) velocityX, (int) velocityY);
imageView.post(mCurrentFlingRunnable);
}
}
代码示例来源:origin: jiangqqlmj/FastDev4Android
@Override
public final void onFling(float startX, float startY, float velocityX,
float velocityY) {
if (DEBUG) {
Log.d(LOG_TAG, "onFling. sX: " + startX + " sY: " + startY
+ " Vx: " + velocityX + " Vy: " + velocityY);
}
ImageView imageView = getImageView();
if (hasDrawable(imageView)) {
mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
mCurrentFlingRunnable.fling(imageView.getWidth(),
imageView.getHeight(), (int) velocityX, (int) velocityY);
imageView.post(mCurrentFlingRunnable);
}
}
代码示例来源:origin: jeasonlzy/NineGridView
@Override
public void onAnimationUpdate(ValueAnimator animation) {
long duration = animation.getDuration();
long playTime = animation.getCurrentPlayTime();
float fraction = duration > 0 ? (float) playTime / duration : 1f;
if (fraction > 1) fraction = 1;
view.setTranslationX(evaluateInt(fraction, imageData.imageViewX + imageData.imageViewWidth / 2 - imageView.getWidth() / 2, 0));
view.setTranslationY(evaluateInt(fraction, imageData.imageViewY + imageData.imageViewHeight / 2 - imageView.getHeight() / 2, 0));
view.setScaleX(evaluateFloat(fraction, vx, 1));
view.setScaleY(evaluateFloat(fraction, vy, 1));
view.setAlpha(fraction);
rootView.setBackgroundColor(evaluateArgb(fraction, Color.TRANSPARENT, Color.BLACK));
}
});
代码示例来源:origin: jeasonlzy/NineGridView
@Override
public void onAnimationUpdate(ValueAnimator animation) {
long duration = animation.getDuration();
long playTime = animation.getCurrentPlayTime();
float fraction = duration > 0 ? (float) playTime / duration : 1f;
if (fraction > 1) fraction = 1;
view.setTranslationX(evaluateInt(fraction, 0, imageData.imageViewX + imageData.imageViewWidth / 2 - imageView.getWidth() / 2));
view.setTranslationY(evaluateInt(fraction, 0, imageData.imageViewY + imageData.imageViewHeight / 2 - imageView.getHeight() / 2));
view.setScaleX(evaluateFloat(fraction, 1, vx));
view.setScaleY(evaluateFloat(fraction, 1, vy));
view.setAlpha(1 - fraction);
rootView.setBackgroundColor(evaluateArgb(fraction, Color.BLACK, Color.TRANSPARENT));
}
});
代码示例来源:origin: square/picasso
@Test public void waitsForAnotherLayoutIfWidthOrHeightIsZero() {
ImageView target = mockFitImageViewTarget(true);
when(target.getWidth()).thenReturn(0);
when(target.getHeight()).thenReturn(0);
RequestCreator creator = mock(RequestCreator.class);
DeferredRequestCreator request = new DeferredRequestCreator(creator, target, null);
request.onPreDraw();
verify(target.getViewTreeObserver(), never()).removeOnPreDrawListener(request);
verifyZeroInteractions(creator);
}
代码示例来源:origin: square/picasso
@Test
public void intoImageViewWithFitAndNoDimensionsQueuesDeferredImageViewRequest() {
ImageView target = mockFitImageViewTarget(true);
when(target.getWidth()).thenReturn(0);
when(target.getHeight()).thenReturn(0);
new RequestCreator(picasso, URI_1, 0).fit().into(target);
verify(picasso, never()).enqueueAndSubmit(any(Action.class));
verify(picasso).defer(eq(target), any(DeferredRequestCreator.class));
}
代码示例来源:origin: androidquery/androidquery
private void draw(Canvas canvas, ImageView iv, Bitmap bm){
Matrix m = getMatrix(iv, bm);
if(m != null){
int vpad = iv.getPaddingTop() + iv.getPaddingBottom();
int hpad = iv.getPaddingLeft() + iv.getPaddingRight();
if(vpad > 0 || hpad > 0){
canvas.clipRect(0, 0, iv.getWidth() - hpad, iv.getHeight() - vpad);
}
canvas.drawBitmap(bm, m, getPaint());
}
if(!adjusted){
adjust(iv, bm, true);
}
}
代码示例来源:origin: square/picasso
@Test
public void intoImageViewWithFitAndDimensionsQueuesImageViewRequest() {
ImageView target = mockFitImageViewTarget(true);
when(target.getWidth()).thenReturn(100);
when(target.getHeight()).thenReturn(100);
new RequestCreator(picasso, URI_1, 0).fit().into(target);
verify(picasso).enqueueAndSubmit(actionCaptor.capture());
assertThat(actionCaptor.getValue()).isInstanceOf(ImageViewAction.class);
}
代码示例来源:origin: square/picasso
@Override public boolean onPreDraw() {
ImageView target = this.target;
ViewTreeObserver vto = target.getViewTreeObserver();
if (!vto.isAlive()) {
return true;
}
int width = target.getWidth();
int height = target.getHeight();
if (width <= 0 || height <= 0) {
return true;
}
target.removeOnAttachStateChangeListener(this);
vto.removeOnPreDrawListener(this);
this.creator.unfit().resize(width, height).into(target, callback);
return true;
}
代码示例来源:origin: square/picasso
@Test public void preDrawSubmitsRequestAndCleansUp() {
Picasso picasso = mock(Picasso.class);
when(picasso.transformRequest(any(Request.class))).thenAnswer(TRANSFORM_REQUEST_ANSWER);
RequestCreator creator = new RequestCreator(picasso, URI_1, 0);
ImageView target = mockFitImageViewTarget(true);
when(target.getWidth()).thenReturn(100);
when(target.getHeight()).thenReturn(100);
ViewTreeObserver observer = target.getViewTreeObserver();
DeferredRequestCreator request = new DeferredRequestCreator(creator, target, null);
request.onPreDraw();
verify(observer).removeOnPreDrawListener(request);
verify(picasso).enqueueAndSubmit(actionCaptor.capture());
Action value = actionCaptor.getValue();
assertThat(value).isInstanceOf(ImageViewAction.class);
assertThat(value.request.targetWidth).isEqualTo(100);
assertThat(value.request.targetHeight).isEqualTo(100);
}
}
内容来源于网络,如有侵权,请联系作者删除!