本文整理了Java中android.widget.ImageView.setAlpha()
方法的一些代码示例,展示了ImageView.setAlpha()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setAlpha()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setAlpha
暂无
代码示例来源:origin: stackoverflow.com
ImageView myImage = (ImageView) findViewById(R.id.myImage);
myImage.setAlpha(127); //value: [0-255]. Where 0 is fully transparent and 255 is fully opaque.
代码示例来源:origin: xmuSistone/AndroidPileLayout
/**
* rate从零到1
*/
@Override
public void duringAnimation(float rate) {
imageView1.setAlpha(1 - rate);
imageView2.setAlpha(rate);
}
代码示例来源:origin: liuguangqiang/SwipeBack
@Override
public void onViewPositionChanged(float fractionAnchor, float fractionScreen) {
ivShadow.setAlpha(1 - fractionScreen);
}
代码示例来源:origin: stackoverflow.com
ImageView image = (ImageView) findViewById(R.id.myImage);
image.setAlpha(0.3);
代码示例来源:origin: stackoverflow.com
ImageView myImageView = new ImageView(this);
myImageView.setAlpha(xxx);
代码示例来源:origin: arimorty/floatingsearchview
private void changeIcon(ImageView imageView, Drawable newIcon, boolean withAnim) {
imageView.setImageDrawable(newIcon);
if (withAnim) {
ObjectAnimator fadeInVoiceInputOrClear = ObjectAnimator.ofFloat(imageView, "alpha", 0.0f, 1.0f);
fadeInVoiceInputOrClear.start();
} else {
imageView.setAlpha(1.0f);
}
}
代码示例来源:origin: arimorty/floatingsearchview
/**
* Hides the progress bar after
* a prior call to showProgress()
*/
public void hideProgress() {
mSearchProgress.setVisibility(View.GONE);
mLeftAction.setAlpha(0.0f);
mLeftAction.setVisibility(View.VISIBLE);
ObjectAnimator.ofFloat(mLeftAction, "alpha", 0.0f, 1.0f).start();
}
代码示例来源:origin: xinghongfei/LookLook
public static void loadImage(Context context, String url, ImageView imageView) {
if (Config.isNight) {
imageView.setAlpha(0.2f);
imageView.setBackgroundColor(Color.BLACK);
}
Glide.with(context).load(url).centerCrop().into(imageView);
}
}
代码示例来源:origin: arimorty/floatingsearchview
@Override
public void onAnimationEnd(Animator animation) {
//restore normal state
mLeftAction.setScaleX(1.0f);
mLeftAction.setScaleY(1.0f);
mLeftAction.setAlpha(1.0f);
mLeftAction.setVisibility(View.INVISIBLE);
}
});
代码示例来源:origin: Naoki2015/CircleDemo
@Override
public void videoStopped() {
cancelAlphaAnimate(videoFrame);
videoPlayer.setAlpha(0);
videoFrame.setAlpha(1.f);
videoButton.setVisibility(View.VISIBLE);
videoProgress.setVisibility(View.GONE);
videoFrame.setVisibility(View.VISIBLE);
}
代码示例来源:origin: scwang90/SmartRefreshLayout
mCircleView = new CircleImageView(context,CIRCLE_BG_LIGHT);
mCircleView.setImageDrawable(mProgress);
mCircleView.setAlpha(0f);
thisGroup.addView(mCircleView);
代码示例来源:origin: arimorty/floatingsearchview
@Override
public void onBindSuggestion(View suggestionView, ImageView leftIcon,
TextView textView, SearchSuggestion item, int itemPosition) {
ColorSuggestion colorSuggestion = (ColorSuggestion) item;
String textColor = mIsDarkSearchTheme ? "#ffffff" : "#000000";
String textLight = mIsDarkSearchTheme ? "#bfbfbf" : "#787878";
if (colorSuggestion.getIsHistory()) {
leftIcon.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
R.drawable.ic_history_black_24dp, null));
Util.setIconColor(leftIcon, Color.parseColor(textColor));
leftIcon.setAlpha(.36f);
} else {
leftIcon.setAlpha(0.0f);
leftIcon.setImageDrawable(null);
}
textView.setTextColor(Color.parseColor(textColor));
String text = colorSuggestion.getBody()
.replaceFirst(mSearchView.getQuery(),
"<font color=\"" + textLight + "\">" + mSearchView.getQuery() + "</font>");
textView.setText(Html.fromHtml(text));
}
代码示例来源:origin: arimorty/floatingsearchview
@Override
public void onBindSuggestion(View suggestionView, ImageView leftIcon,
TextView textView, SearchSuggestion item, int itemPosition) {
ColorSuggestion colorSuggestion = (ColorSuggestion) item;
String textColor = mIsDarkSearchTheme ? "#ffffff" : "#000000";
String textLight = mIsDarkSearchTheme ? "#bfbfbf" : "#787878";
if (colorSuggestion.getIsHistory()) {
leftIcon.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
R.drawable.ic_history_black_24dp, null));
Util.setIconColor(leftIcon, Color.parseColor(textColor));
leftIcon.setAlpha(.36f);
} else {
leftIcon.setAlpha(0.0f);
leftIcon.setImageDrawable(null);
}
textView.setTextColor(Color.parseColor(textColor));
String text = colorSuggestion.getBody()
.replaceFirst(mSearchView.getQuery(),
"<font color=\"" + textLight + "\">" + mSearchView.getQuery() + "</font>");
textView.setText(Html.fromHtml(text));
}
代码示例来源:origin: ZieIony/Carbon
@Override
public void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha) {
super.setAlpha(alpha);
invalidateParentIfNeeded();
fireOnTransformationChangedListener();
}
代码示例来源:origin: arimorty/floatingsearchview
public void onTextChanged(final CharSequence s, int start, int before, int count) {
//todo investigate why this is called twice when pressing back on the keyboard
if (mSkipTextChangeEvent || !mIsFocused) {
mSkipTextChangeEvent = false;
} else {
if (mSearchInput.getText().toString().length() != 0 &&
mClearButton.getVisibility() == View.INVISIBLE) {
mClearButton.setAlpha(0.0f);
mClearButton.setVisibility(View.VISIBLE);
ViewCompat.animate(mClearButton).alpha(1.0f).setDuration(CLEAR_BTN_FADE_ANIM_DURATION).start();
} else if (mSearchInput.getText().toString().length() == 0) {
mClearButton.setVisibility(View.INVISIBLE);
}
if (mQueryListener != null && mIsFocused && !mOldQuery.equals(mSearchInput.getText().toString())) {
mQueryListener.onSearchTextChanged(mOldQuery, mSearchInput.getText().toString());
}
}
mOldQuery = mSearchInput.getText().toString();
}
代码示例来源:origin: north2016/T-MVP
void forward(int position, float positionOffset) {
if (isSkip) return;
// Log.e("DEBUG-WCL", "forward-positionOffset: " + positionOffset);
int width = mTargetImage.getWidth();
mOutgoingImage.setTranslationX(-positionOffset * (FACTOR * width));
mTargetImage.setTranslationX((1 - positionOffset) * (FACTOR * width));
int color = BaseUtils.evaluate(positionOffset, mColors[position], mColors[position + 1]);
collapsingToolbar.setContentScrimColor(color);
collapsingToolbar.setStatusBarScrimColor(color);
mTargetImage.setAlpha(positionOffset);
}
代码示例来源:origin: north2016/T-MVP
void backwards(int position, float positionOffset) {
if (isSkip) return;
// Log.e("DEBUG-WCL", "backwards-positionOffset: " + positionOffset);
int width = mTargetImage.getWidth();
mOutgoingImage.setTranslationX((1 - positionOffset) * (FACTOR * width));
mTargetImage.setTranslationX(-(positionOffset) * (FACTOR * width));
int color = BaseUtils.evaluate(1 - positionOffset, mColors[position + 1], mColors[position]);
collapsingToolbar.setContentScrimColor(color);
collapsingToolbar.setStatusBarScrimColor(color);
mTargetImage.setAlpha(1 - positionOffset);
}
代码示例来源:origin: ZieIony/Carbon
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
ImageView imageView = (ImageView) animator.getTarget();
float fraction = animator.getAnimatedFraction();
saturationMatrix.setSaturation((Float) animator.getAnimatedValue());
float scale = 2 - interpolator.getInterpolation(Math.min((1 - fraction) * 4 / 3, 1));
brightnessMatrix.setScale(scale, scale, scale, 1);
saturationMatrix.preConcat(brightnessMatrix);
imageView.setColorFilter(new ColorMatrixColorFilter(saturationMatrix));
imageView.setAlpha(interpolator.getInterpolation(Math.min((1 - fraction) * 2, 1)));
}
});
代码示例来源:origin: ZieIony/Carbon
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
ImageView imageView = (ImageView) animator.getTarget();
float fraction = animator.getAnimatedFraction();
saturationMatrix.setSaturation((Float) animator.getAnimatedValue());
float scale = 2 - interpolator.getInterpolation(Math.min(fraction * 4 / 3, 1));
brightnessMatrix.setScale(scale, scale, scale, 1);
saturationMatrix.preConcat(brightnessMatrix);
imageView.setColorFilter(new ColorMatrixColorFilter(saturationMatrix));
imageView.setAlpha(interpolator.getInterpolation(Math.min(fraction * 2, 1)));
}
});
代码示例来源:origin: aa112901/remusic
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
if (dragging) {
int toolbarHeight = mHeaderView.getHeight() - mActionBarSize - mStatusSize - tabLayout.getHeight();
float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
if (firstScroll) {
if (-toolbarHeight < currentHeaderTranslationY) {
mBaseTranslationY = scrollY;
}
}
float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
}
toolbar_bac.setImageResource(R.drawable.toolbar_background_black);
float a = (float) scrollY / (ViewHelper.getScrollY(mHeaderView));
toolbar_bac.setAlpha(a);
}
内容来源于网络,如有侵权,请联系作者删除!