本文整理匯總了Java中android.graphics.drawable.Drawable.getAlpha方法的典型用法代碼示例。如果您正苦於以下問題:Java Drawable.getAlpha方法的具體用法?Java Drawable.getAlpha怎麽用?Java Drawable.getAlpha使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.Drawable
的用法示例。
在下文中一共展示了Drawable.getAlpha方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: StatusbarBattery
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public StatusbarBattery(View batteryView) {
mBattery = batteryView;
createHooks();
try {
Object drawable = getDrawable();
final int[] colors = (int[]) XposedHelpers.getObjectField(drawable, "mColors");
mDefaultColor = colors[colors.length - 1];
if (Utils.isLineageOs()) {
Drawable frameDrawable = (Drawable) XposedHelpers.getObjectField(drawable, "mFrameDrawable");
// mDefaultFrameColor = frameDrawable.setTint();
mFrameAlpha = frameDrawable.getAlpha();
} else {
final Paint framePaint = (Paint) XposedHelpers.getObjectField(drawable, "mFramePaint");
mDefaultFrameColor = framePaint.getColor();
mFrameAlpha = framePaint.getAlpha();
}
mDefaultChargeColor = XposedHelpers.getIntField(drawable, "mChargeColor");
} catch (Throwable t) {
log("Error backing up original colors: " + t.getMessage());
}
if (SysUiManagers.IconManager != null) {
SysUiManagers.IconManager.registerListener(this);
}
}
示例2: get
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@Override
public Integer get(View view) {
Drawable background = view.getBackground();
if (background instanceof LayerDrawable
&& ((LayerDrawable) background).getNumberOfLayers() > 0) {
background = ((LayerDrawable) background).getDrawable(0);
}
return background.getAlpha();
}
示例3: getAlpha
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public static int getAlpha(Drawable drawable) {
return drawable.getAlpha();
}