I\'m trying out the android ScaleDrawable
But it doesn\'t seem to work... I created the xml as in the documentation example and I have a logo.png in the drawable fol
To answer to the initial question, you just have to initialize your ScaleDrawable's Level with 10 000 in your onCreate. You get your ImageView, ImageButton's drawable using getIcon or getBackground (depends if you set it as a source or a background) and then call setLevel on it. For a MenuItem, the code looks like :
editMenuItem = menu.findItem(R.id.action_edit);
menuItemEdit_ScaleDrawable = (ScaleDrawable) editMenuItem.getIcon();
//when playing with scaleDrawable always initialize the level
menuItemEdit_ScaleDrawable.setLevel(10000);
I use ScaleDrawable when running animation that changes the size of the drawable. For your usecase, I definitely prefer managing the size of the component not the drawable displayed by the component.