I have two buttons in my android app. "(+)Increase image dimension" & "" (-)Dicrease image dimension"" and i want on click to increase or dicrease a imageView that i have.
that's all!
try something like this to increase width
and height
with 5 :
final android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
buttonIncrease.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
layoutParams.width += 5;
layoutParams.height += 5;
imageView.setLayoutParams(layoutParams);
}
});
imageView.getLayoutParams().height += 1; (or -) imageView.getLayoutParams().width += 1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.