本文整理匯總了Java中android.widget.ImageView.invalidate方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.invalidate方法的具體用法?Java ImageView.invalidate怎麽用?Java ImageView.invalidate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.invalidate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupBitmap
import android.widget.ImageView; //導入方法依賴的package包/類
private void setupBitmap(ImageView imageView, float width, float height) {
Drawable drawable = imageView.getDrawable();
if (drawable == null) {
return;
}
try {
bitmap = (drawable instanceof BitmapDrawable) ?
((BitmapDrawable) drawable).getBitmap() :
Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
} catch (Exception e) {
e.printStackTrace();
}
if (bitmap == null) {
imageView.invalidate();
return;
}
paint = new Paint(ANTI_ALIAS_FLAG);
bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
paint.setShader(bitmapShader);
if (imageView.getScaleType() != ImageView.ScaleType.CENTER_CROP && imageView.getScaleType() != ImageView.ScaleType.FIT_XY) {
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
bitmapShader.setLocalMatrix(setUpScaleType(bitmap, imageView, width, height));
imageView.invalidate();
}
示例2: onAnimationUpdate
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ImageMatrixCorrector corrector = getCorrector();
ImageView imageView = corrector.getImageView();
Matrix matrix = imageView.getImageMatrix();
float[] values = getValues();
matrix.getValues(values);
float dx = (float) animation.getAnimatedValue(PROPERTY_TRANSLATE_X);
dx = corrector.correctAbsolute(Matrix.MTRANS_X, dx) - values[Matrix.MTRANS_X];
float dy = (float) animation.getAnimatedValue(PROPERTY_TRANSLATE_Y);
dy = corrector.correctAbsolute(Matrix.MTRANS_Y, dy) - values[Matrix.MTRANS_Y];
matrix.postTranslate(dx, dy);
imageView.invalidate();
}
示例3: onAnimationUpdate
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ImageMatrixCorrector corrector = getCorrector();
ImageView imageView = corrector.getImageView();
if(imageView.getDrawable() != null) {
Matrix matrix = imageView.getImageMatrix();
float[] values = getValues();
matrix.getValues(values);
float sx = (float) animation.getAnimatedValue();
sx = corrector.correctAbsolute(Matrix.MSCALE_X, sx) / values[Matrix.MSCALE_X];
if (translate) {
matrix.postScale(sx, sx, px, py);
} else {
matrix.postScale(sx, sx);
}
corrector.performAbsoluteCorrections();
imageView.invalidate();
}
}
示例4: updateSnakeImage
import android.widget.ImageView; //導入方法依賴的package包/類
public void updateSnakeImage() {
if (null == mTargetView) return;
updateTargetViewCache();
for (ImageView child : mChildren) {
child.setImageBitmap(mTargetBitmap);
child.invalidate();
}
}
示例5: setIconColor
import android.widget.ImageView; //導入方法依賴的package包/類
public static void setIconColor(ImageView iconHolder, int color) {
Drawable wrappedDrawable = DrawableCompat.wrap(iconHolder.getDrawable());
DrawableCompat.setTint(wrappedDrawable, color);
iconHolder.setImageDrawable(wrappedDrawable);
iconHolder.invalidate();
}
示例6: onShutter
import android.widget.ImageView; //導入方法依賴的package包/類
public void onShutter() {
ImageView blinkRect = (ImageView) findViewById(R.id.blink_rectangle);
blinkRect.setVisibility(View.VISIBLE);
blinkRect.bringToFront();
blinkRect.invalidate();
}
示例7: DrawBlink
import android.widget.ImageView; //導入方法依賴的package包/類
void DrawBlink() {
SystemClock.sleep(500);
ImageView blinkRect = (ImageView) findViewById(R.id.blink_rectangle);
blinkRect.setVisibility(View.INVISIBLE);
blinkRect.invalidate();
}