Last active
December 19, 2015 13:58
-
-
Save markushi/5965445 to your computer and use it in GitHub Desktop.
Elegant solution to determine view width and height after the view has been measured.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
final View view = findViewById(...) | |
view.post(new Runnable() { | |
@Override | |
public void run() { | |
int width = view.getWidth(); | |
int height = view.getHeight(); | |
... | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment