Reputation: 2329
I have created a custom Button class and I want to be able to change its width/height depending on some factors in addition to the content width/height. How can I do this?
I am new to Android so I bet I am missing something really obvious, so please enlighten me.
Upvotes: 0
Views: 482
Reputation: 2329
Ok, I figured this: override the onMeasure function.
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int w = <calculation>
int h = <calculation>
setMeasuredDimension(w, h);
}
Upvotes: 1