C
C
couldDog2014-10-28 23:27:24
Android
couldDog, 2014-10-28 23:27:24

How to get the height value of the TextView field before running the application?

Hello, in my application I need to get the value of the height of the text field when the application has started, but it has not yet been interacted with. For example, display a Toast message with the height value immediately after launch.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Copperfield, 2014-10-29
@Copperfield

Try like this

someTextView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                //here
            }
        });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question