CustomView(Context c, Boolean animate) {
    super(c);
    this.animate = animate;
    p = new Paint();
    p.setColor(Color.BLACK);
    setLayoutParams(new ActionBar.LayoutParams(100, 100));
    setPivotX(getX() + getWidth() / 2);
    setPivotY(getY() + getHeight() / 2);
    if(animate)
    {
        post(this);
    }
}
in my constructor first I set the layout params 100x100, then I want to set the pivot point into the center, but the getWidth() and getHeight() returns 0, thus as if the setLayoutParams() didn't worked, why this happens? cause I have to hardcode the size I want
 
     
    