本文整理了Java中android.widget.ImageView.getResources()
方法的一些代码示例,展示了ImageView.getResources()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getResources()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getResources
暂无
代码示例来源:origin: bumptech/glide
@Override
protected Drawable getDrawable(Bitmap resource) {
return new BitmapDrawable(view.getResources(), resource);
}
}
代码示例来源:origin: androidquery/androidquery
private static Drawable makeDrawable(ImageView iv, Bitmap bm, float ratio, float anchor){
BitmapDrawable bd = null;
if(ratio > 0){
bd = new RatioDrawable(iv.getResources(), bm, iv, ratio, anchor);
}else{
bd = new BitmapDrawable(iv.getResources(), bm);
}
return bd;
}
代码示例来源:origin: koral--/android-gif-drawable
private static int getResourceId(ImageView view, AttributeSet attrs, final boolean isSrc) {
final int resId = attrs.getAttributeResourceValue(ANDROID_NS, isSrc ? "src" : "background", 0);
if (resId > 0) {
final String resourceTypeName = view.getResources().getResourceTypeName(resId);
if (SUPPORTED_RESOURCE_TYPE_NAMES.contains(resourceTypeName) && !setResource(view, isSrc, resId)) {
return resId;
}
}
return 0;
}
代码示例来源:origin: koral--/android-gif-drawable
@SuppressWarnings("deprecation")
static boolean setResource(ImageView view, boolean isSrc, int resId) {
Resources res = view.getResources();
if (res != null) {
try {
final String resourceTypeName = res.getResourceTypeName(resId);
if (!SUPPORTED_RESOURCE_TYPE_NAMES.contains(resourceTypeName)) {
return false;
}
GifDrawable d = new GifDrawable(res, resId);
if (isSrc) {
view.setImageDrawable(d);
} else {
view.setBackground(d);
}
return true;
} catch (IOException | Resources.NotFoundException ignored) {
//ignored
}
}
return false;
}
代码示例来源:origin: medyo/android-about-page
Drawable drawable = VectorDrawableCompat.create(iconView.getResources(), element.getIconDrawable(), iconView.getContext().getTheme());
iconView.setImageDrawable(drawable);
} else {
代码示例来源:origin: omadahealth/LolliPin
/**
* Called by {@link FingerprintManager} if the authentication failed (bad finger etc...).
*/
@Override
public void onAuthenticationFailed() {
showError(mIcon.getResources().getString(
R.string.pin_code_fingerprint_not_recognized));
}
代码示例来源:origin: googlesamples/android-FingerprintDialog
@Override
public void onAuthenticationFailed() {
showError(mIcon.getResources().getString(
R.string.fingerprint_not_recognized));
}
代码示例来源:origin: stackoverflow.com
public static void stripImageView(ImageView view) {
if ( view.getDrawable() instanceof BitmapDrawable ) {
((BitmapDrawable)view.getDrawable()).getBitmap().recycle();
}
view.getDrawable().setCallback(null);
view.setImageDrawable(null);
view.getResources().flushLayoutCache();
view.destroyDrawingCache();
}
代码示例来源:origin: jingle1267/android-utils
/**
* Set drawable on child image view
*
* @param id
* @param drawable
* @return image view
*/
public ImageView setDrawable(final int id, final int drawable) {
ImageView image = imageView(id);
image.setImageDrawable(image.getResources().getDrawable(drawable));
return image;
}
代码示例来源:origin: mozilla-tw/Rocket
@Override
protected Drawable getDrawable(Bitmap resource) {
return new BitmapDrawable(view.getResources(), resource);
}
}
代码示例来源:origin: com.googlecode.android-query/android-query
private static Drawable makeDrawable(ImageView iv, Bitmap bm, float ratio, float anchor){
BitmapDrawable bd = null;
if(ratio > 0){
bd = new RatioDrawable(iv.getResources(), bm, iv, ratio, anchor);
}else{
bd = new BitmapDrawable(iv.getResources(), bm);
}
return bd;
}
代码示例来源:origin: Meiqia/MeiqiaSDK-Android
public static void tintPressedIndicator(ImageView imageView, @DrawableRes int normalResId, @DrawableRes int pressedResId) {
Drawable normal = imageView.getResources().getDrawable(normalResId);
Drawable pressed = imageView.getResources().getDrawable(pressedResId);
pressed = MQUtils.tintDrawable(imageView.getContext(), pressed, R.color.mq_indicator_selected);
imageView.setImageDrawable(getPressedSelectorDrawable(normal, pressed));
}
代码示例来源:origin: thealeksandr/PFLockScreen-Android
@Override
public void onAuthenticationFailed() {
showError(mIcon.getResources().getString(
R.string.fingerprint_not_recognized_pf));
}
代码示例来源:origin: advanced-android-book/samples
@Override
public void onAuthenticationFailed() {
showError(mIcon.getResources().getString(
R.string.fingerprint_not_recognized));
}
代码示例来源:origin: geniusgithub/AndroidDialer
@Override
public void applyDefaultImage(ImageView view, int extent, boolean darkTheme,
DefaultImageRequest defaultImageRequest) {
final Drawable drawable = getDefaultImageForContact(view.getResources(),
defaultImageRequest);
view.setImageDrawable(drawable);
}
代码示例来源:origin: sregg/spotify-tv
private void fadeIn() {
mImageView.setAlpha(0f);
if (mAttachedToWindow) {
int duration =
mImageView.getResources().getInteger(android.R.integer.config_shortAnimTime);
mImageView.animate().alpha(1f).setDuration(duration);
}
}
代码示例来源:origin: advanced-android-book/samples
@Override
protected void setResource(Bitmap resource) {
// 画像を丸く切り抜く
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(imageView.getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
代码示例来源:origin: WhiteDG/BihuDaily
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(imageView.getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
代码示例来源:origin: hitherejoe/LeanbackCards
private void fadeIn() {
ImageView mImageView = mPreviewCard.getImageView();
mImageView.setAlpha(0f);
if (mAttachedToWindow) {
int duration =
mImageView.getResources().getInteger(android.R.integer.config_shortAnimTime);
mImageView.animate().alpha(1f).setDuration(duration);
}
}
代码示例来源:origin: googlesamples/android-AutofillFramework
void bind(FieldMetadata fieldMetadata) {
mWatcher.updatePosition(getAdapterPosition());
Drawable drawable = mIcon.getResources().getDrawable(fieldMetadata.getIconRes());
mIcon.setImageDrawable(drawable);
mLabel.setText(fieldMetadata.getLabelRes());
mField.setAutofillHints(fieldMetadata.getAutofillHint());
mField.setInputType(fieldMetadata.getInputType());
mField.setText(fieldMetadata.getEnteredText());
// IMPORTANT: setAutofillId of recycled View.
mField.setAutofillId(fieldMetadata.getAutofillId());
}
}
内容来源于网络,如有侵权,请联系作者删除!