Closed ArcherN9 closed 4 years ago
Just the boring layout or the whole view? I believe it could be issue with height of the view. Will look into it.
@blazsolar Just the boring layouts. Yes, the issue is with the height of the elements. I did a dirty fix on this. unsure atm if it'll break something else.
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int height;
if(heightMode == MeasureSpec.EXACTLY) {
height = heightSize;
} else {
Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
int heightText = (int) (Math.abs(fontMetrics.ascent) + Math.abs(fontMetrics.descent));
heightText += getPaddingTop() + getPaddingBottom();
//height = Math.min(heightSize, heightText);
//Changed the above Math.min() to Math.max() since `heightSize` is always 0 in ScrollView. Hence, the height is always 0 being the closest value to negative infinity (Math.min functionality.)
height = Math.max(heightSize, heightText);
}
setMeasuredDimension(width, height);
}
The
BoringLayout
does not show up when the HorizontalPicker view is placed inside aScrollView
. It works flawlessly when the same is implemented elsewhere though. There's no exception thrown, and there are no call backs triggered when items are selected.