本文整理匯總了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawable.setCornerRadius方法的典型用法代碼示例。如果您正苦於以下問題:Java RoundedBitmapDrawable.setCornerRadius方法的具體用法?Java RoundedBitmapDrawable.setCornerRadius怎麽用?Java RoundedBitmapDrawable.setCornerRadius使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.graphics.drawable.RoundedBitmapDrawable
的用法示例。
在下文中一共展示了RoundedBitmapDrawable.setCornerRadius方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initHalloweenTheme
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
private void initHalloweenTheme() {
if (!isHalloween) {
return;
}
Bitmap bmp = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ground);
RoundedBitmapDrawable dr = RoundedBitmapDrawableFactory.create(getContext().getResources(), bmp);
dr.setCornerRadius(dialogRadius);
dr.setAntiAlias(true);
ground.setBackgroundDrawable(dr);
plane.setImageResource(R.drawable.witch);
tomb.setImageResource(R.drawable.tomb_hw);
moon.setVisibility(View.VISIBLE);
ground.setVisibility(View.VISIBLE);
pumpkin.setVisibility(View.VISIBLE);
wifiOn.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
mobileOn.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
airplaneOff.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
}
示例2: onCreate
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_do);
ButterKnife.bind(this);
// handDo();
// processRetry();
// processRetryWhen();
// processRepeat();
processRepeatWhen();
GradientDrawable drawable = new GradientDrawable();
drawable.setColor(Color.BLUE);
drawable.setCornerRadius(5);
tvD.setText("贏");
tvD.setBackground(drawable);
BitmapDrawable drawable1 = new BitmapDrawable(getResources(), BitmapFactory.decodeResource(getResources(), R.drawable.bg1));
Bitmap bm = drawTBit(drawable1);
ivDo.setImageBitmap(drawCircle(bm));
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), BitmapFactory.decodeResource(getResources(), R.drawable.bg1));
roundedBitmapDrawable.setCornerRadius(20);
ivDo1.setImageDrawable(roundedBitmapDrawable);
}
示例3: onDraw
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onDraw(Canvas canvas) {
if (bitmap != null) {
int size = Math.min(canvas.getWidth(), canvas.getHeight());
if (size != this.size) {
this.size = size;
bitmap = ThumbnailUtils.extractThumbnail(bitmap, size, size);
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
roundedBitmapDrawable.setCornerRadius(size / 2);
roundedBitmapDrawable.setAntiAlias(true);
bitmap = ImageUtils.drawableToBitmap(roundedBitmapDrawable);
}
canvas.drawBitmap(bitmap, 0, 0, paint);
}
}
示例4: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(
Bitmap icon, int fallbackColor, boolean isFallbackColorDefault) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(mItem.getUrl());
mItemView.setIcon(new BitmapDrawable(getResources(), icon));
mItem.setTileType(isFallbackColorDefault ? MostVisitedTileType.ICON_DEFAULT
: MostVisitedTileType.ICON_COLOR);
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(), icon);
int cornerRadius = Math.round(ICON_CORNER_RADIUS_DP
* getResources().getDisplayMetrics().density * icon.getWidth()
/ mDesiredIconSize);
roundedIcon.setCornerRadius(cornerRadius);
roundedIcon.setAntiAlias(true);
roundedIcon.setFilterBitmap(true);
mItemView.setIcon(roundedIcon);
mItem.setTileType(MostVisitedTileType.ICON_REAL);
}
mSnapshotMostVisitedChanged = true;
if (mIsInitialLoad) loadTaskCompleted();
}
示例5: updateUi
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
public void updateUi(Card card) {
TextView extraText = (TextView) findViewById(R.id.extra_text);
TextView primaryText = (TextView) findViewById(R.id.primary_text);
final ImageView imageView = (ImageView) findViewById(R.id.main_image);
extraText.setText(card.getExtraText());
primaryText.setText(card.getTitle());
// Create a rounded drawable.
int resourceId = card.getLocalImageResourceId(getContext());
Bitmap bitmap = BitmapFactory
.decodeResource(getContext().getResources(), resourceId);
RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(getContext().getResources(), bitmap);
drawable.setAntiAlias(true);
drawable.setCornerRadius(
Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f);
imageView.setImageDrawable(drawable);
}
示例6: setupImageView
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
public void setupImageView() {
if (imageView != null) {
String path = PrefHelper.getString(PrefConstant.CUSTOM_ICON);
if (!InputHelper.isEmpty(path)) {
path = Uri.decode(PrefHelper.getString(PrefConstant.CUSTOM_ICON));
boolean fileExists = new File(path).exists();
if (fileExists) {
imageView.setImageDrawable(null);
Bitmap src = BitmapFactory.decodeFile(path);
if (src == null) {
imageView.setImageResource(R.drawable.ic_app_drawer_icon);
onMoving(false);
return;
}
RoundedBitmapDrawable dr = RoundedBitmapDrawableFactory.create(getResources(), src);
dr.setCornerRadius(Math.max(src.getWidth(), src.getHeight()) / 2.0f);
imageView.setImageDrawable(dr);
return;
}
}
imageView.setImageResource(R.drawable.ic_app_drawer_icon);
onMoving(false);
}
}
示例7: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(Bitmap icon, int fallbackColor,
boolean isFallbackColorDefault) {
// TODO(twellington): move this somewhere that can be shared with bookmarks.
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(getItem().getUrl());
mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), icon));
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(),
Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplayedIconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
mIconImageView.setImageDrawable(roundedIcon);
}
}
示例8: onBitmapLoaded
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
// Updating icons from Java is not supported prior to API 11.
if (!AppConstants.Versions.feature11Plus) {
return;
}
final Drawable drawable;
if (cornerRadius > 0) {
final RoundedBitmapDrawable roundedBitmapDrawable;
roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(resources, bitmap);
roundedBitmapDrawable.setCornerRadius(cornerRadius);
roundedBitmapDrawable.setAntiAlias(true);
drawable = roundedBitmapDrawable;
} else {
drawable = new BitmapDrawable(resources, bitmap);
}
preference.setIcon(drawable);
}
示例9: transform
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
private Bitmap transform(Bitmap source, int size) {
if (source != null) {
RoundedBitmapDrawable drawable =
RoundedBitmapDrawableFactory.create(getResources(), source);
drawable.setCornerRadius(100);
Bitmap.Config config = source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
Bitmap output = Bitmap.createBitmap(size, size, config);
Canvas canvas = new Canvas(output);
drawable.setAntiAlias(true);
drawable.setBounds(0, 0, size, size);
drawable.draw(canvas);
if (!source.equals(output)) {
source.recycle();
}
return output;
}
return null;
}
示例10: getRoundBitmap
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
private Bitmap getRoundBitmap(@DrawableRes int drawable, int size) {
Bitmap bitmap = ImageUtils.drawableToBitmap(ContextCompat.getDrawable(getContext(), drawable));
bitmap = Bitmap.createBitmap(bitmap, bitmap.getWidth() / 6, bitmap.getHeight() / 6, (int) (0.666 * bitmap.getWidth()), (int) (0.666 * bitmap.getHeight()));
bitmap = ThumbnailUtils.extractThumbnail(bitmap, size, size);
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
roundedBitmapDrawable.setCornerRadius(size / 2);
roundedBitmapDrawable.setAntiAlias(true);
return ImageUtils.drawableToBitmap(roundedBitmapDrawable);
}
示例11: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(
Bitmap icon, int fallbackColor, boolean isFallbackColorDefault) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(mUrl);
mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), icon));
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(),
Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplayedIconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
mIconImageView.setImageDrawable(roundedIcon);
}
}
示例12: getFaviconDrawable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
private Drawable getFaviconDrawable(Bitmap icon, int fallbackColor, String url) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(url);
return new BitmapDrawable(getResources(), icon);
} else {
RoundedBitmapDrawable roundedIcon =
RoundedBitmapDrawableFactory.create(getResources(),
Bitmap.createScaledBitmap(icon, mFaviconSize, mFaviconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
return roundedIcon;
}
}
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:14,代碼來源:ConfirmImportantSitesDialogFragment.java
示例13: getView
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
relativeLayout = (RelativeLayout) layoutInflater.inflate(R.layout.list_item_album, parentView, false);
if (position % 2 - 1 == 0) {
relativeLayout.setBackgroundResource(R.color.gray_2);
} else {
relativeLayout.setBackgroundResource(R.color.gray_3);
}
// Get parts of layout
ImageView albumCover = (ImageView) relativeLayout.findViewById(R.id.album_cover);
TextView albumName = (TextView) relativeLayout.findViewById(R.id.album_name);
TextView albumSize = (TextView) relativeLayout.findViewById(R.id.album_size);
// Get values
String name = keyList.get(position);
Drawable cover = songAlbumList.get(name).get(0).getSongCover();
RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(activity.getResources(), ((BitmapDrawable) cover).getBitmap());
drawable.setCornerRadius(50.0f);
int size = songAlbumList.get(name).size();
// Set values
albumCover.setImageDrawable(drawable);
albumName.setText(name);
if (size == 1) {
albumSize.setText("1 song");
} else {
albumSize.setText(Integer.toString(size) + " songs");
}
// Return
relativeLayout.setTag(position);
return relativeLayout;
}
示例14: getCircleDrawable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
public static RoundedBitmapDrawable getCircleDrawable(Context context, Bitmap bitmap) {
RoundedBitmapDrawable circleDrawable = RoundedBitmapDrawableFactory.create(context
.getResources(), bitmap);
circleDrawable.setAntiAlias(true);
circleDrawable.setCornerRadius(((float) Math.min(bitmap.getWidth(), bitmap.getHeight()))
/ 2.0f);
return circleDrawable;
}
示例15: getRoundedDrawable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
public static RoundedBitmapDrawable getRoundedDrawable(Context context, Bitmap bitmap, float
cornerRadius) {
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(context
.getResources(), bitmap);
roundedBitmapDrawable.setAntiAlias(true);
roundedBitmapDrawable.setCornerRadius(cornerRadius);
return roundedBitmapDrawable;
}