Last active
August 9, 2020 17:22
-
-
Save OwloneDev/899c1a158a677cbb8e5ab2c86d0e72a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun imageScaling(imageResource: Int): BitmapDrawable { | |
val options = BitmapFactory.Options() | |
options.inScaled = false | |
val bitmap = BitmapFactory.decodeResource(context.resources, imageResource, options) | |
val bitmapDrawable = BitmapDrawable(context.resources, bitmap) | |
bitmapDrawable.isFilterBitmap = false | |
return bitmapDrawable | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageView.setImageDrawable(imageScaling(R.drawable.myImage)) | |
imageView2.background = imageScaling(R.drawable.myImage) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment