Is there a backwards compatible way to find out if a view is laid out? View
has isLaidOut
, but it's API 19. I currently use if(view.getWidth() + view.getHeight() > 0)
, but it doesn't look like a stable and clean way to do this. I'm aware of OnGlobalLayoutListener
, but I want to know if a view is laid out right now.
This also had me stumped for a while.
If you're using the support-v4 libraries, then you can use:
ViewCompat.isLaidOut(View)
Check out the implementation:
ViewCompat.java
ViewCompatBase.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With