本文整理汇总了Java中de.hdodenhof.circleimageview.CircleImageView.setImageResource方法的典型用法代码示例。如果您正苦于以下问题:Java CircleImageView.setImageResource方法的具体用法?Java CircleImageView.setImageResource怎么用?Java CircleImageView.setImageResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.hdodenhof.circleimageview.CircleImageView
的用法示例。
在下文中一共展示了CircleImageView.setImageResource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, FriendInfo item) {
CircleImageView profileImg = helper.getView(R.id.friend_profile_list_item);
CircleImageView onlineImg = helper.getView(R.id.online_flag_img);
Utility.loadFriendProfileImg(mContext.getApplicationContext(), item.getUsername(), profileImg);
if (item.isOnline()) {
onlineImg.setVisibility(View.VISIBLE);
onlineImg.setImageResource(R.drawable.green);
} else {
onlineImg.setVisibility(View.INVISIBLE);
}
helper.setText(R.id.friend_name_list_item, item.getUsername());
helper.setText(R.id.friend_des_list_item,
String.format("今日跑步%d次 | 共跑步%d次", item.getNumToday(), item.getNumAll()));
}
示例2: ShadowImageView
import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
public ShadowImageView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
super(context, attrs, defStyleAttr);
setBackgroundColor(getResources().getColor(android.R.color.transparent));
//获取自定义属性值
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShadowImageView);
if (attrs == null) return;
try {
mShadowOffsetX = a.getDimension(R.styleable.ShadowImageView_shadowOffsetX, 0.0f);
mShadowOffsetY = a.getDimension(R.styleable.ShadowImageView_shadowOffsetY, 0.0f);
mShadowRadius = a.getDimension(R.styleable.ShadowImageView_shadowRadius, 0.0f);
mImgId = a.getResourceId(R.styleable.ShadowImageView_src, -1);
} catch (Exception e) {
e.printStackTrace();
} finally {
a.recycle();
}
mImageView = new CircleImageView(context);
mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
mImageView.setImageResource(mImgId);
addView(mImageView);
int xPadding = (int) (mShadowRadius + Math.abs(mShadowOffsetX));
int yPadding = (int) (mShadowRadius + Math.abs(mShadowOffsetY));
setPadding(xPadding, yPadding, xPadding, yPadding);
}
示例3: fillDrawerLayoutInfo
import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
private void fillDrawerLayoutInfo() {
//空指针异常
drawerHead = (CircleImageView) findViewById(R.id.nav_head_image);
drawerNickName = (TextView) findViewById(R.id.nav_head_nickname);
drawerPhone = (TextView) findViewById(R.id.nav_head_phonenum);
verifyLogo = (ImageView) findViewById(R.id.nav_head_verify_logo);
if (isLogin) {
curUser.readFromLocalDatabase();
drawerHead.setImageBitmap(Utility.convertStringToBitmap(curUser.getHeadIcon()));
drawerNickName.setText(curUser.getNickName());
//////
String phoneT = curUser.getPhoneNum();
drawerPhone.setText(phoneT.substring(0, 3) + "****" + phoneT.substring(7));
drawerHead.setOnClickListener(null);
if (curUser.isVerified()) {
verifyLogo.setImageResource(R.mipmap.icon_yes_verify);
} else {
verifyLogo.setImageResource(R.mipmap.icon_no_verify);
}
} else {
curUser.setNullValue();
drawerHead.setImageResource(R.drawable.login);
drawerNickName.setText(curUser.getNickName());
drawerPhone.setText(curUser.getPhoneNum());
drawerHead.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(ClientMainActivity.this, LoginActivity.class));
//finish();
}
});
verifyLogo.setImageBitmap(null);
}
}