/// <summary> /// Returns a <see cref="Drawable"/> with the correct dimensions from an /// Android resource id. /// </summary> /// <param name="resId">The android resource id to load the drawable from.</param> /// <param name="width">The width to scale to.</param> /// <param name="height">The height to scale to.</param> /// <returns>A scaled <see cref="Drawable"/>.</returns> public Drawable GetScaleDrawableFromResourceId(int resId, int width, int height) { var drawable = Resources.GetDrawable(resId); var returnValue = new ScaleDrawable(drawable, 0, width, height).Drawable; returnValue.SetBounds(0, 0, width, height); return returnValue; }
/// <summary> /// Returns a <see cref="Drawable"/> with the correct dimensions from an /// Android resource id. /// </summary> /// <param name="drawable">An android <see cref="Drawable"/>.</param> /// <param name="width">The width to scale to.</param> /// <param name="height">The height to scale to.</param> /// <returns>A scaled <see cref="Drawable"/>.</returns> private Drawable GetScaleDrawable(Drawable drawable, int width, int height) { var returnValue = new ScaleDrawable(drawable, 0, RequestToPixels(width), RequestToPixels(height)).Drawable; returnValue.SetBounds(0, 0, width, height); return returnValue; }
/// <summary> /// Returns a <see cref="Drawable"/> with the correct dimensions from an /// Android resource id. /// </summary> /// <param name="drawable">An android <see cref="Drawable"/>.</param> /// <param name="width">The width to scale to.</param> /// <param name="height">The height to scale to.</param> /// <returns>A scaled <see cref="Drawable"/>.</returns> private Drawable GetScaleDrawable(Drawable drawable, int width, int height) { var returnValue = new ScaleDrawable(drawable, 0, width, height).Drawable; returnValue.SetBounds(0, 0, width, height); return returnValue; }