I have to measure a View for spacing others. I use this code for that:
ViewGroup view = ...;
view.setPadding(10, 0, 10, 0);
int wrapContent = RelativeLayout.LayoutParams.WRAP_CONTENT;
int specWidth = MeasureSpec.makeMeasureSpec(wrapContent, MeasureSpec.AT_MOST);
view.measure(specWidth, specWidth);
int questionWidth = view.getMeasuredWidth();
This works as expected on an Android 4.3 emulator.
However the returned measured width on a Samsung Galaxy XCover 2 (S7710) Android 4.1.2 phone, is 16777214...
I tried everything, masking with View.MEASURED_SIZE_MASK, but nothing helped.
Could you provide some help with this? Thanks in advance!