I am trying to get the width of a button whose android:layout_width
is set to wrap_content
. When I try to do that in onCreate()
using getMeasuredWidth()
, I get a value of zero because I think the view is not ready yet.
When should I get the width then? Is there any listener I can hook to when view is done initializing?