How to get dimensions of a specific layout, for example linearlayout or relativelayout, with its layout_width and layout_height set to wrap_content? using this method
layout.measure(MeasureSpec.makeMeasureSpec(0,
MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0,
MeasureSpec.UNSPECIFIED));
layout.layout(0, 0,
layout.getMeasuredWidth(),
layout.getMeasuredHeight());
returns null. I am trying to create a bitmap image from relativelayout, kind of like a screenshot.
source
share