Merge "Use fallback linespacing in ChartSweepView and ChartGridView"

This commit is contained in:
Roozbeh Pournader
2017-08-24 19:24:01 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 5 deletions

View File

@@ -170,8 +170,9 @@ public class ChartGridView extends View {
paint.setColor(mLabelColor);
paint.setTextSize(mLabelSize);
return new StaticLayout(text, paint,
(int) Math.ceil(Layout.getDesiredWidth(text, paint)),
Layout.Alignment.ALIGN_NORMAL, 1.f, 0, true);
return StaticLayout.Builder.obtain(text, 0, text.length(), paint,
(int) Math.ceil(Layout.getDesiredWidth(text, paint)))
.setUseLineSpacingFromFallbacks(true)
.build();
}
}

View File

@@ -265,8 +265,11 @@ public class ChartSweepView extends View {
paint.setColor(mLabelColor);
mLabelTemplate = new SpannableStringBuilder(template);
mLabelLayout = new DynamicLayout(
mLabelTemplate, paint, LARGE_WIDTH, Alignment.ALIGN_RIGHT, 1f, 0f, false);
mLabelLayout = DynamicLayout.Builder.obtain(mLabelTemplate, paint, LARGE_WIDTH)
.setAlignment(Alignment.ALIGN_RIGHT)
.setIncludePad(false)
.setUseLineSpacingFromFallbacks(true)
.build();
invalidateLabel();
} else {