Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Fixed picker spinner to size/position columns correctly on Android 5.0 and higher #9674

Merged
merged 7 commits into from
May 11, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,13 @@ protected void onDraw(Canvas canvas) {
if (itemsWidth > 0) {
canvas.save();
// Skip padding space and hide a part of top and bottom items
canvas.translate(PADDING, -getItemOffset());
float translateY;
if (Build.VERSION.SDK_INT < 21) {
translateY = -getItemOffset();
} else {
translateY = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maggie, this UI widget still has offset issues on API Levels > 21, right? I think we should by translating by the value returned by getTextSize() for the higher API Levels. This is because we offset it by text size here.

That is, it should look like this...

if (Build.VERSION.SDK_INT < 21) {
	translateY = -getItemOffset();
} else {
	translateY = getTextSize() / 2.0f;
}

Can you give the above a go please?

}
canvas.translate(PADDING, translateY);
drawItems(canvas);
drawValue(canvas);
canvas.restore();
Expand Down