Solution 1 :
It doesn’t work because lineSpacingExtra
isn’t supported inside TextAppearance:
Some common TextView attributes not included are lineHeight[Multiplier|Extra], lines, breakStrategy & hyphenationFrequency. TextAppearance works at the character level, not paragraph so attributes affecting the whole layout are not supported. TextView styling by Nick Butcher
The solution for me was to use MaterialTextView along with lineHeight
attribute:
<com.google.android.material.textview.MaterialTextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_text="Lorem ipsum lorem ipsum lorem ipsum lorem ipsum..."
android_textAppearance="@style/CustomAppearance" />
<style name="CustomAppearance">
<item name="lineHeight">30sp</item>
</style>
Problem :
I have a TextView
whit custom TextAppearance
that changes space between lines:
<style name="CustomAppearance">
<item name="android:lineSpacingExtra">30sp</item>
</style>
<TextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_text="Lorem ipsum lorem ipsum lorem ipsum lorem ipsum..."
android_textAppearance="@style/CustomAppearance" />
The problem is that lineSpacingExtra
value is ignored when the app launches. (Though it works if I use CustomAppearance
through style
instead of textAppearance
attribute)
Comments
Comment posted by stackoverflow.blog/2011/07/01/…
People downvoting and flagging this: Please read