Simple question, perhaps frustratingly-complex-but-hopefully-simple answer?
What is the \"Best Practice\" for getting the actual height of an element that has its si
Definitely is more complicated than it seems it should be. An easier way that I've found compared to the answer in the suggested question, is to use a ViewTreeObserver. In your onCreate() method, you can use some code such as the following:
TextView textView = (TextView)findViewById(R.id.my_textview);
ViewTreeObserver observer = textView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
//in here, place the code that requires you to know the dimensions.
//this will be called as the layout is finished, prior to displaying.
}
});