1. When a class is initialized, that is, in the constructor we are not getting the actual size of the view. Interested friends can try, getwidth () and getmeasuredwidth () results are all 0. But we can get the size of the control from inside the OnDraw () method.
2. The two results are measured in pixels, or pixel.
GetWidth (): Gets the width value of the view after it has been laid out in the parent layout, and if there is no parent, the default parent layout is the entire screen.
Getmeasuredwidth (): First look at what the API says.
The width of this view is measured in the most recent call to measure (). This should is used during measurement and layout calculations only.
The last call to the measure () method is the width of the view, which is used only in the calculation of measurement and layout. So this method gets the actual width that the view's content occupies.
Summary (positive solution):
GetWidth (): View the width of the entire view after setting the layout.
Getmeasuredwidth (): The width of the view content that is obtained when the content on the view is measured, if you must call measure (0,0) in the parent layout's OnLayout () method or in the OnDraw () method of this view;( You can define the values of the parameters in measure, otherwise you get the same results as the getwidth ().
Transferred from: http://blog.csdn.net/wangbofei/article/details/7795430
Android GetWidth and Getmeasuredwidth