Skip to content

Instantly share code, notes, and snippets.

@markushi
markushi / ViewWidthHeight.java
Last active December 19, 2015 13:58
Elegant solution to determine view width and height after the view has been measured.
@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();