fabiomsr / MoneyTextView

A simple Android TextView to display amounts of money in different formats.
509 stars 71 forks source link

Text bounds are not calculated properly #9

Open gastoncesarf opened 6 years ago

gastoncesarf commented 6 years ago

Hi, I can't found a pattern, but the calculus of bounds is wrong. Here my code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <org.fabiomsr.moneytextview.MoneyTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:amount="1256.56"
        app:gravity="center"
        app:symbolTextSize="45sp"
        app:decimalDigitsTextSize="45sp"
        app:baseTextSize="45sp"
        app:decimalSeparator="."
        app:symbol="$"/>

    <org.fabiomsr.moneytextview.MoneyTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:gravity="center"
        app:amount="1.23"
        app:symbolTextSize="45sp"
        app:decimalDigitsTextSize="45sp"
        app:baseTextSize="45sp"
        app:decimalSeparator="."
        app:symbol="$"/>

    <org.fabiomsr.moneytextview.MoneyTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:gravity="center"
        app:amount="1.44"
        app:symbolTextSize="45sp"
        app:decimalDigitsTextSize="45sp"
        app:baseTextSize="45sp"
        app:decimalSeparator="."
        app:symbol="$"/>
</LinearLayout>

I try this with the last version 1.1.0, and this is the result (the integer and symbol section is not aligned with decimal part): screen shot 2017-09-16 at 7 31 38 pm screen shot 2017-09-16 at 7 32 09 pm screen shot 2017-09-16 at 7 32 25 pm

gastoncesarf commented 6 years ago

In previus version: screen shot 2017-09-16 at 7 45 27 pm screen shot 2017-09-16 at 7 45 44 pm