views:

45

answers:

1

I'm trying to add a little space between lines to my TextViews using android:lineSpacingMultiplier from the documentation:

Extra spacing between lines of text, as a multiplier.

Must be a floating point value, such as "1.2".

As I'm using this in a few different TextViews I would like to add a global dimension/value to my resources, but I don't know which tag to use, if it even exists. I have tried all resource types that make sense to me, but none of them works.

What I would like to have would be something like this:

<resources>
    <dimen name="text_line_spacing">1.4</dimen>
</resources>

Edit: I'm aware of android:lineSpacingExtra (which needs a dimension with an appended unit), but I'd like to use android:lineSpacingMultiplier if possible.

A: 

I found a solution, which works, but does result in a Warning (WARN/Resources(268): Converting to float: TypedValue{t=0x3/d=0x4d "1.2" a=2 r=0x7f06000a}) in LogCat.

<resources>
    <string name="text_line_spacing">1.2/string>
</resources>

android:lineSpacingMultiplier="@string/text_line_spacing"/>
slup