I have created a small test app to try out scale drawable.
I define my drawable in xml and save it as scale_up.xml
. I have a main.xml
layout file with an ImageView
. I use android:src="@drawable/scale_up"
in the ImageView to use the drawable I created in xml. In my activity I use myImageView.setImageLevel(some level here)
to set the level of the ImageView defined in main.xml
. All's well and the ImageView displays the drawable defined in scale_up.
My confusion is the following:
- changing the
scaleHeight
andscaleWidth
% inscale_up.xml
makes no perceivable difference if the level is set at 10000 - changing the level in
setImageLevel
(between 0 and 10000) changes the size of the image - really only perceivable at around 5000. the higher the % value for scaleHeight and scaleWidth, the smaller the image (depending on the value ofsetImageLevel()
)
I suppose my question/s are:
- is it correct to use
setImageLevel()
, passing a level between 0 and 10000 - in the activity to control the size of the drawable defined in the xml file? - what is the relationship between scaleHeight, scaleWidth and
setImageLevel()
- as I see it now, I may as well just set the scaleHeight and scaleWidth to 100% and then usesetImageLevel(5000)
to get a 50% scaled image - i.e increasing or reducingsetImageLevel(0 to 10000)
will change the scale - making thescaleHeight
andscaleWidth
% pretty pointless.
appreciate any clarification of this and perhaps an example of how to use scale drawable (defined in xml) correctly.