当前位置: 首页>>代码示例>>Java>>正文


Java RoundedBitmapDrawable.setCircular方法代码示例

本文整理汇总了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawable.setCircular方法的典型用法代码示例。如果您正苦于以下问题:Java RoundedBitmapDrawable.setCircular方法的具体用法?Java RoundedBitmapDrawable.setCircular怎么用?Java RoundedBitmapDrawable.setCircular使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.graphics.drawable.RoundedBitmapDrawable的用法示例。


在下文中一共展示了RoundedBitmapDrawable.setCircular方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public void bind(Party party, int position) {
    //make the image circular
    //make the image circular
    if (!TextUtils.isEmpty(party.getPicturePath())) {
        RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(
                getContext().getResources(),
                party.getPicturePath());

        bitmapDrawable.setCircular(true);
        picImageView.setImageDrawable(bitmapDrawable);
    } else {
        picImageView.setImageResource(R.drawable.default_party_pic);
    }

    partyNameTV.setText(party.getName());

    double balance = party.calculateBalances();
    balanceTV.setText(UtilsFormat.formatCurrency(balance, getContext()));
    balanceTV.setTextColor(getContext().getResources().getColor(balance < 0 ? R.color.red_medium : R.color.green_medium));
}
 
开发者ID:ndhunju,项目名称:dailyJournal,代码行数:21,代码来源:PartyCardAdapter.java

示例2: setPartyViews

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
private void setPartyViews(Party party){

        //make the image circular
        //make the image circular
        if (!TextUtils.isEmpty(mParty.getPicturePath())) {
            RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(
                    getResources(),
                    mParty.getPicturePath());

            bitmapDrawable.setCircular(true);
            picIV.setImageDrawable(bitmapDrawable);
        } else {
            picIV.setImageResource(R.drawable.default_party_pic);
        }

        nameTV.setText(party.getName());

        balanceTV.setText(UtilsFormat.formatCurrency(party.calculateBalances(), getActivity()));
        balanceTV.setTextColor(getResources().getColor(party.calculateBalances() < 0 ? R.color.red_medium : R.color.green_medium));

        getActivity().setTitle(mParty.getName());

    }
 
开发者ID:ndhunju,项目名称:dailyJournal,代码行数:24,代码来源:PartyDetailFragment.java

示例3: clipToRound

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
/**
 * 把 Bitmap 变圆。
 *
 * @param context Context
 * @param bitmap 要处理的 Bitmap
 * @return 圆形的 Bitmap
 */
public static Bitmap clipToRound(Context context, Bitmap bitmap) {
    final RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(context.getResources(), bitmap);
    drawable.setAntiAlias(true);
    drawable.setCircular(true);
    drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());

    bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    drawable.draw(canvas);

    return bitmap;
}
 
开发者ID:RikkaApps,项目名称:FCM-for-Mojo,代码行数:20,代码来源:ChatIcon.java

示例4: get

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
static RoundedBitmapDrawable get(Activity activity, Uri thumbnail) {

        RoundedBitmapDrawable dr = null;

        try {
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(activity.getContentResolver(), thumbnail);
            dr = RoundedBitmapDrawableFactory.create(activity.getResources(), bitmap);
            dr.setCircular(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dr;
    }
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:14,代码来源:RoundedContact.java

示例5: makeCircle

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static Bitmap makeCircle(Bitmap bitmap) {
    RoundedBitmapDrawable roundedPhoto = RoundedBitmapDrawableFactory.create(Resources
            .getSystem(), bitmap);

    roundedPhoto.setCircular(true);

    return roundedPhoto.getBitmap();
}
 
开发者ID:a-deda,项目名称:share-location,代码行数:9,代码来源:PhotoFixer.java

示例6: setImageDrawable

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void setImageDrawable(Drawable drawable) {
    Bitmap bitmap = drawableToBitmap(drawable);
    RoundedBitmapDrawable d = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
    d.setCircular(true);
    super.setImageDrawable(d);
}
 
开发者ID:gvinciguerra,项目名称:custode,代码行数:8,代码来源:RoundedContactBadge.java

示例7: TransformToRounded

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static Bitmap TransformToRounded(Bitmap source, Context mContext, int width, int heigth) {
    // Create the RoundedBitmapDrawable.
    RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(mContext.getResources(), source);
    drawable.setCircular(true);
    //drawable.setCornerRadius(mContext.getCornerRadius(source));
    Bitmap output = Bitmap.createBitmap(width, heigth, source.getConfig());
    Canvas canvas = new Canvas(output);
    drawable.setAntiAlias(true);
    drawable.setBounds(0, 0, width, heigth);
    drawable.draw(canvas);
    if (source != output) {
        source.recycle();
    }
    return output;
}
 
开发者ID:malah-code,项目名称:Open-Quran-Radio,代码行数:16,代码来源:ImageHelper.java

示例8: setRoundImage

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
void setRoundImage(ImageView view,int id){

        Bitmap bitmap = BitmapFactory.decodeResource(this.getResources(),id);
        RoundedBitmapDrawable roundedBitmapDrawable= RoundedBitmapDrawableFactory.create(getResources(),bitmap);
        roundedBitmapDrawable.setCornerRadius(2.0f);
        roundedBitmapDrawable.setCircular(true);
        view.setImageDrawable(roundedBitmapDrawable);

    }
 
开发者ID:appteam-nith,项目名称:Hillffair,代码行数:10,代码来源:ThemeSelectionActivity.java

示例9: roundedBitmap

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static Drawable roundedBitmap(Bitmap bitmap) {
    RoundedBitmapDrawable circleDrawable = RoundedBitmapDrawableFactory.create(App.getInstance().getResources(), bitmap);
    circleDrawable.getPaint().setAntiAlias(true);
    circleDrawable.setCircular(true);
    circleDrawable.setCornerRadius(Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f);
    return circleDrawable;
}
 
开发者ID:shegang,项目名称:meishiDemo,代码行数:8,代码来源:DrawableUtils.java

示例10: doInBackground

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
protected RoundedBitmapDrawable doInBackground(String... urlToScrape) {
    InputStream is = null;
    RoundedBitmapDrawable roundDrawable = null;
    try {
        is = (InputStream) new URL(urlToScrape[0]).getContent();
        roundDrawable = RoundedBitmapDrawableFactory.create(activity.getResources(), is);
        roundDrawable.setCircular(true);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return roundDrawable;
}
 
开发者ID:R-a-dio,项目名称:R-a-dio-Amazing-Android-App,代码行数:14,代码来源:DJImageTask.java

示例11: setAvatarPreLollipop

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
private void setAvatarPreLollipop(@DrawableRes int resId) {
    Drawable drawable = ResourcesCompat.getDrawable(getResources(), resId,
            getContext().getTheme());
    BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
    @SuppressWarnings("ConstantConditions")
    RoundedBitmapDrawable roundedDrawable = RoundedBitmapDrawableFactory.create(getResources(),
            bitmapDrawable.getBitmap());
    roundedDrawable.setCircular(true);
    setImageDrawable(roundedDrawable);
}
 
开发者ID:vanpersie9987,项目名称:android-topeka,代码行数:11,代码来源:AvatarView.java

示例12: bindImageView

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void bindImageView(ImageView imageView) {
    if (imageView != null) {
        RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(imageView.getResources(), avatar);
        circularBitmapDrawable.setCircular(true);
        imageView.setImageDrawable(circularBitmapDrawable);
    }
}
 
开发者ID:two-guys-one-code,项目名称:TGOCMessagesActivity,代码行数:9,代码来源:TGOCAvatar.java

示例13: convertToCircularImageView

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static void convertToCircularImageView(ImageView v) {
        int backgroundColor = ((ColorDrawable) v.getBackground()).getColor();
        Bitmap bitmap = Bitmap.createBitmap(v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888);
        bitmap.eraseColor(backgroundColor);

        // Replace drawable.
        RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(v.getResources(), bitmap);
        drawable.setCircular(true);
        v.setBackground(drawable);

        // Causing these log entries in 6.0:
        // Called getWidth() on a recycle()'d bitmap! This is undefined behavior!
        // Called getHeight() on a recycle()'d bitmap! This is undefined behavior!
//        bitmap.recycle();
    }
 
开发者ID:cpoppema,项目名称:pass-mobile-android,代码行数:16,代码来源:ImageViewHelper.java

示例14: cropRoundedImageView

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
/**
 * Crop ImageView in parameter for create a circle
 */
private void cropRoundedImageView(ImageView imageView) {
    Bitmap imageBitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
    RoundedBitmapDrawable imageDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), imageBitmap);
    imageDrawable.setCircular(true);
    imageDrawable.setCornerRadius(Math.max(imageBitmap.getWidth(), imageBitmap.getHeight()) / 2.0f);
    imageView.setImageDrawable(imageDrawable);
}
 
开发者ID:Kunzisoft,项目名称:RememBirthday,代码行数:11,代码来源:ContactAdapter.java

示例15: setResource

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
protected void setResource(Bitmap resource) {
    RoundedBitmapDrawable circularBitmapDrawable =
            RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
    circularBitmapDrawable.setCircular(true);
    getView().setImageDrawable(circularBitmapDrawable);
}
 
开发者ID:AndroidIasi,项目名称:CodeCamp,代码行数:8,代码来源:CircleBitmapImageViewTarget.java


注:本文中的android.support.v4.graphics.drawable.RoundedBitmapDrawable.setCircular方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。