Fix font issue

This commit is contained in:
Victor Shcherb 2011-12-14 23:49:45 +01:00
parent 7bbf67fa95
commit bfffe28f57
2 changed files with 7 additions and 5 deletions

View file

@ -54,6 +54,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
private final MapActivity activity;
private Drawable boxLeg;
private float scaleCoefficient = 1;
private Rect textPadding;
public ContextMenuLayer(MapActivity activity){
this.activity = activity;
@ -83,7 +84,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
textView = new TextView(view.getContext());
LayoutParams lp = new LayoutParams(BASE_TEXT_SIZE, LayoutParams.WRAP_CONTENT);
textView.setLayoutParams(lp);
textView.setTextSize(15 * scaleCoefficient);
textView.setTextSize(15);
textView.setTextColor(Color.argb(255, 0, 0, 0));
textView.setMinLines(1);
// textView.setMaxLines(15);
@ -92,6 +93,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
textView.setClickable(true);
textView.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_free));
textPadding = new Rect();
textView.getBackground().getPadding(textPadding);
}
@Override
@ -107,8 +110,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
canvas.translate(-tx, -ty);
if (textView.getText().length() > 0) {
int topMarginDiff = (int) (5 * scaleCoefficient);
canvas.translate(x - textView.getWidth() / 2, ty - textView.getBottom() - topMarginDiff);
canvas.translate(x - textView.getWidth() / 2, ty - textView.getBottom() + textPadding.bottom - textPadding.top);
int c = textView.getLineCount();
textView.draw(canvas);

View file

@ -547,8 +547,8 @@ public class MapInfoLayer extends OsmandMapLayer {
// Back to location icon
params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.leftMargin = (int) (10 * scaleCoefficient);
params.rightMargin = 0;
params.leftMargin = (int) (5 * scaleCoefficient);
params.rightMargin = (int) (5 * scaleCoefficient);
backToLocation = new ImageView(view.getContext());
backToLocation.setImageDrawable(view.getResources().getDrawable(R.drawable.back_to_loc));
backToLocation.setOnClickListener(new View.OnClickListener() {