I have a view made up of TableLayout, TableRow and TextView
. I want it to look like a grid. I need to get the height and width of this grid. The methods
As F.X. mentioned, you can use an OnLayoutChangeListener
to the view that you want to track itself
view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
// Make changes
}
});
You can remove the listener in the callback if you only want the initial layout.