本文整理匯總了Java中android.graphics.drawable.BitmapDrawable.getPaint方法的典型用法代碼示例。如果您正苦於以下問題:Java BitmapDrawable.getPaint方法的具體用法?Java BitmapDrawable.getPaint怎麽用?Java BitmapDrawable.getPaint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.BitmapDrawable
的用法示例。
在下文中一共展示了BitmapDrawable.getPaint方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyLeafRounding
import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
/**
* Rounds the given drawable with a {@link RoundedBitmapDrawable} or {@link RoundedColorDrawable}.
*
* <p> If the given drawable is not a {@link BitmapDrawable} or a {@link ColorDrawable}, it is
* returned without being rounded.
*
* @return the rounded drawable, or the original drawable if rounding didn't take place
*/
private static Drawable applyLeafRounding(
Drawable drawable,
RoundingParams roundingParams,
Resources resources) {
if (drawable instanceof BitmapDrawable) {
final BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
RoundedBitmapDrawable roundedBitmapDrawable =
new RoundedBitmapDrawable(
resources,
bitmapDrawable.getBitmap(),
bitmapDrawable.getPaint());
applyRoundingParams(roundedBitmapDrawable, roundingParams);
return roundedBitmapDrawable;
}
if (drawable instanceof ColorDrawable &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
RoundedColorDrawable roundedColorDrawable =
RoundedColorDrawable.fromColorDrawable((ColorDrawable) drawable);
applyRoundingParams(roundedColorDrawable, roundingParams);
return roundedColorDrawable;
}
return drawable;
}
示例2: fromBitmapDrawable
import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
/**
* Creates a new RoundedBitmapDrawable from the given BitmapDrawable.
* @param res resources to use for this drawable
* @param bitmapDrawable bitmap drawable containing the bitmap to be used for this drawable
* @return the RoundedBitmapDrawable that is created
*/
public static RoundedBitmapDrawable fromBitmapDrawable(
Resources res,
BitmapDrawable bitmapDrawable) {
return new RoundedBitmapDrawable(res, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
}