fabiomsr / MoneyTextView

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

add ability adjust padding on decimal #6

Closed JefferyEmanuel closed 7 years ago

JefferyEmanuel commented 7 years ago

I'd like to adjust the height of the superscript. right now the gravity is just top or bottom . could you make one for center or the ability to add padding so i can push the decimal text down to my specification ? Or can you show me how you got it like this screenshot:

screen shot 2017-04-03 at 11 54 20 pm

because i see thats what i want but your examples dont demo how the decimal part can be perfectly aligned with the dollar part like in that photo.

fabiomsr commented 7 years ago

Hi,

You only need to set both symbolGravity and decimalGravity:

        app:symbolGravity="start|top"
        app:decimalGravity="top"

Try this:

<org.fabiomsr.moneytextview.MoneyTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:symbol="$"
        app:amount="99.99"

        app:symbolGravity="start|top"
        app:decimalGravity="top"

        app:symbolTextSize="18sp"
        app:baseTextSize="35sp"
        app:decimalDigitsTextSize="18sp"

        app:decimalMargin="6dp"
        app:symbolMargin="6dp"
        app:includeDecimalSeparator="false"
        app:baseTextColor="#FBFFE3"/>

example

JefferyEmanuel commented 7 years ago

your comments showed me how to do this. the android preview window wasn't updating for some reason but at runtime everything renders fine. excellent.