Here is my code:
if (myView == null) {
myView = new View(mContext) {
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
final float width = (float)getWidth();
......
}
};
addView(myView);
}
requestLayout();
The width in my code is always 0 although the size of the mContext is not zero. Can anybody advise what could be the possible reason I got 0 for width? Thanks