public void repeatSong(View view)
{
if (repeatFlag) //If repeatFlag (Repeat Function) is activated
{
//onClick, icon change to dactivated state
btnRepeat.setBackgroundResource(R.drawable.repeatwhiteicon);
btnRepeat.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
btnRepeat.setMinimumHeight(70);
btnRepeat.setMinimumWidth(70);
}
else //If repeatFlag (Repeat Function) is deactivated
{
//onClick, icon change to activated state
btnRepeat.setBackgroundResource(R.drawable.repeatblueicon);
btnRepeat.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
}
// onClick, repeatSong function is inverted (Activated-Deactivated OR Deactivated-Activated)
repeatFlag = !repeatFlag;
}
btnRepeat is a ImageButton, it is a ImageButton when clicked, is supposed to changed to another image. However, I do not know how to change the layout_width
and layout_height
of the image. I managed to figure out how to change the scale type of the image. btnRepeat.setMinimumHeight(70);
and btnRepeat.setMinimumWidth(70);
did not work in my case.
How do I change it then? Thank you in advance.