本文整理匯總了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);
}
}