Yes, I tested the proposal and it works!
Sample code.
Display display = getWindowManager().getDefaultDisplay(); View s = findViewById(R.id.Screen); // Screen is a container layout s.measure(display.getWidth(), display.getHeight()); View c = findViewById(R.id.Cell0); Log.i(TAG, "cell width = " + String.valueOf(c.getMeasuredWidth()) + " height = " + String.valueOf(c.getMeasuredHeight()));
What I do not understand is how I skipped this! :) I knew everything about the measurement process, but I was stuck in using it in custom views ...
source share