本文整理了Java中android.graphics.drawable.Drawable.getAlpha()
方法的一些代码示例,展示了Drawable.getAlpha()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.getAlpha()
方法的具体详情如下:
包路径:android.graphics.drawable.Drawable
类名称:Drawable
方法名:getAlpha
暂无
代码示例来源:origin: facebook/litho
public static float getAlpha(Drawable drawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final int scaledValue = drawable.getAlpha();
return scaledValue / 255f;
} else {
// TODO(T28432326): using reflection check if drawable has getAlpha(), if so, invoke it
return 1;
}
}
代码示例来源:origin: bumptech/glide
@RequiresApi(Build.VERSION_CODES.KITKAT)
@Override
public int getAlpha() {
return wrapped.getAlpha();
}
代码示例来源:origin: square/assertj-android
@TargetApi(KITKAT)
public S hasAlpha(int alpha) {
isNotNull();
int actualAlpha = actual.getAlpha();
assertThat(actualAlpha) //
.overridingErrorMessage("Expected alpha <%s> but was <%s>.", alpha, actualAlpha) //
.isEqualTo(alpha);
return myself;
}
代码示例来源:origin: ZieIony/Carbon
@Override
@TargetApi(Build.VERSION_CODES.KITKAT)
public int getAlpha() {
final Drawable dr = getFirstNonNullDrawable();
if (dr != null) {
return dr.getAlpha();
} else {
return super.getAlpha();
}
}
代码示例来源:origin: albert-lii/ImageViewer
public int getBackgroundAlpha() {
if (mBackground != null) {
return mBackground.getAlpha();
} else {
return NO_BACKGROUND_ALPHA;
}
}
代码示例来源:origin: fookwood/Launcher3
public int getAlpha() {
return mImage.getAlpha();
}
代码示例来源:origin: AlexMofer/ProjectX
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public int getAlpha() {
if (mDrawable == null)
return super.getAlpha();
return mDrawable.getAlpha();
}
代码示例来源:origin: com.albedinsky.android/ui-graphics-base
/**
*/
@Override
@SuppressLint("NewApi")
public int getAlpha() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? mDrawable.getAlpha() : 0;
}
代码示例来源:origin: com.albedinsky.android/ui-graphics
/**
*/
@Override
@SuppressLint("NewApi")
public int getAlpha() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? mDrawable.getAlpha() : 0;
}
代码示例来源:origin: MCMrARM/revolution-irc
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public int getAlpha() {
return mDrawable.getAlpha();
}
代码示例来源:origin: albert-lii/ImageViewer
@Override
public void changeBackgroundAlpha(int alpha) {
if (canChangeBgAlpha
&& mBackground != null
&& mBackground.getAlpha() != alpha) {
mBackground.setAlpha(alpha);
}
}
代码示例来源:origin: mozilla-tw/Rocket
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public int getAlpha() {
return wrapped.getAlpha();
}
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
@SuppressLint("NewApi")
public int getAlpha() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? mDrawable.getAlpha() : 0;
}
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
public static void fadeDrawableAlpha(final Drawable d, int endAlpha) {
ValueAnimator animator = getDefaultValueAnimator(d.getAlpha(), endAlpha);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
d.setAlpha((Integer) valueAnimator.getAnimatedValue());
}
});
animator.start();
}
}
代码示例来源:origin: AlexMofer/ProjectX
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public int getAlpha() {
if (mDrawable == null)
return super.getAlpha();
return mDrawable.getAlpha();
}
代码示例来源:origin: com.albedinsky.android/dialogs-collection
/**
* Draws the given <var>shadowDrawable</var> on the given <var>canvas</var> if the drawable is not
* {@code null}, is visible and its alpha is grater than {@code 0}.
*
* @param canvas The canvas where to draw the shadow.
* @param shadowDrawable The drawable that represents the shadow to be drawn.
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
private void drawShadow(Canvas canvas, Drawable shadowDrawable) {
if (shadowDrawable != null && shadowDrawable.isVisible()) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || shadowDrawable.getAlpha() > 0) {
shadowDrawable.draw(canvas);
}
}
}
代码示例来源:origin: com.albedinsky.android/dialogs-collection-base
/**
* Draws the given <var>shadowDrawable</var> on the given <var>canvas</var> if the drawable is not
* {@code null}, is visible and its alpha is grater than {@code 0}.
*
* @param canvas The canvas where to draw the shadow.
* @param shadowDrawable The drawable that represents the shadow to be drawn.
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
private void drawShadow(Canvas canvas, Drawable shadowDrawable) {
if (shadowDrawable != null && shadowDrawable.isVisible()) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || shadowDrawable.getAlpha() > 0) {
shadowDrawable.draw(canvas);
}
}
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs-collection-base
/**
* Draws the given <var>shadowDrawable</var> on the given <var>canvas</var> if the drawable is not
* {@code null}, is visible and its alpha is grater than {@code 0}.
*
* @param canvas The canvas where to draw the shadow.
* @param shadowDrawable The drawable that represents the shadow to be drawn.
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
private void drawShadow(Canvas canvas, Drawable shadowDrawable) {
if (shadowDrawable != null && shadowDrawable.isVisible()) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || shadowDrawable.getAlpha() > 0) {
shadowDrawable.draw(canvas);
}
}
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
* Draws the given <var>shadowDrawable</var> on the given <var>canvas</var> if the drawable is not
* {@code null}, is visible and its alpha is grater than {@code 0}.
*
* @param canvas The canvas where to draw the shadow.
* @param shadowDrawable The drawable that represents the shadow to be drawn.
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
private void drawShadow(Canvas canvas, Drawable shadowDrawable) {
if (shadowDrawable != null && shadowDrawable.isVisible()) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || shadowDrawable.getAlpha() > 0) {
shadowDrawable.draw(canvas);
}
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
@TargetApi(KITKAT)
public S hasAlpha(int alpha) {
isNotNull();
int actualAlpha = actual.getAlpha();
assertThat(actualAlpha) //
.overridingErrorMessage("Expected alpha <%s> but was <%s>.", alpha, actualAlpha) //
.isEqualTo(alpha);
return myself;
}
内容来源于网络,如有侵权,请联系作者删除!