android安卓onCreate方法中获取控件宽度高度

ViewTreeObserver vto = p_w_picpathView.getViewTreeObserver();   

vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

public void onGlobalLayout() {

p_w_picpathView.getViewTreeObserver().removeGlobalOnLayoutListener(this); 

int height=p_w_picpathView.getHeight();

int width =p_w_picpathView.getWidth();

}

});