下面列出了android.widget.ImageView#setImageAlpha ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void onResume() {
super.onResume();
if (mVideoInfo.state == PlayerState.FINISHED) finish();
if (mMediaRouteController == null) return;
// Lifetime of the media element is bound to that of the {@link MediaStateListener}
// of the {@link MediaRouteController}.
RecordCastAction.recordFullscreenControlsShown(
mMediaRouteController.getMediaStateListener() != null);
mMediaRouteController.prepareMediaRoute();
ImageView iv = (ImageView) findViewById(R.id.cast_background_image);
if (iv == null) return;
Bitmap posterBitmap = mMediaRouteController.getPoster();
if (posterBitmap != null) iv.setImageBitmap(posterBitmap);
iv.setImageAlpha(POSTER_IMAGE_ALPHA);
}
@Override
protected void onResume() {
super.onResume();
if (mVideoInfo.state == PlayerState.FINISHED) finish();
if (mMediaRouteController == null) return;
// Lifetime of the media element is bound to that of the {@link MediaStateListener}
// of the {@link MediaRouteController}.
RecordCastAction.recordFullscreenControlsShown(
mMediaRouteController.getMediaStateListener() != null);
mMediaRouteController.prepareMediaRoute();
ImageView iv = (ImageView) findViewById(R.id.cast_background_image);
if (iv == null) return;
Bitmap posterBitmap = mMediaRouteController.getPoster();
if (posterBitmap != null) iv.setImageBitmap(posterBitmap);
iv.setImageAlpha(POSTER_IMAGE_ALPHA);
}
@Override
protected void onResume() {
super.onResume();
if (mVideoInfo.state == PlayerState.FINISHED) finish();
if (mMediaRouteController == null) return;
// Lifetime of the media element is bound to that of the {@link MediaStateListener}
// of the {@link MediaRouteController}.
RecordCastAction.recordFullscreenControlsShown(
mMediaRouteController.getMediaStateListener() != null);
mMediaRouteController.prepareMediaRoute();
ImageView iv = (ImageView) findViewById(R.id.cast_background_image);
if (iv == null) return;
Bitmap posterBitmap = mMediaRouteController.getPoster();
if (posterBitmap != null) iv.setImageBitmap(posterBitmap);
iv.setImageAlpha(POSTER_IMAGE_ALPHA);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void setImageAlpha(ImageView imageView, int alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
imageView.setImageAlpha(alpha);
} else {
imageView.setAlpha(alpha);
}
}
@Override
public void setValue(ImageView object, int value) {
object.setImageAlpha(value);
}
@Override
public void setValue(ImageView imageView, int value) {
imageView.setImageAlpha(value);
}
@Override
public void set(ImageView imageView, int alpha) {
imageView.setImageAlpha(alpha);
}
@TargetApi(16)
public void setImageAlpha(int viewId, int alpha) {
ImageView target = findViewById(viewId);
target.setImageAlpha(alpha);
}
static void renderPreview(Context context, Attachment attachment, ImageView imageView) {
imageView.setBackgroundColor(StyledAttributes.getColor(context, R.attr.color_background_tertiary));
imageView.setImageAlpha(Math.round(StyledAttributes.getFloat(context, R.attr.icon_alpha) * 255));
imageView.setImageDrawable(StyledAttributes.getDrawable(context, getImageAttr(attachment)));
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void setImageAlpha(ImageView imageView, int alpha) {
imageView.setImageAlpha(alpha);
}
static void renderPreview(Context context, Attachment attachment, ImageView imageView) {
imageView.setBackgroundColor(StyledAttributes.getColor(context, R.attr.color_background_tertiary));
imageView.setImageAlpha(Math.round(StyledAttributes.getFloat(context, R.attr.icon_alpha) * 255));
imageView.setImageDrawable(StyledAttributes.getDrawable(context, getImageAttr(attachment)));
}