Possible Duplicate:
How to size an Android view based on its parent’s dimensions
how do I use getMeasuredWidth()
and getMeasuredHeight
? It always returns 0. what is the diffrence between this and getHeight()
and getWidth()
?
Just got a solution to get height and width of a custom view:
@Override
protected void onSizeChanged(int xNew, int yNew, int xOld, int yOld){
super.onSizeChanged(xNew, yNew, xOld, yOld);
viewWidth = xNew;
viewHeight = yNew;
}
Its working in my case.