Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – lineSpacingExtra doesn’t work on a TextView

Posted on November 11, 2022 By

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

READ  [FIXED] android - What is/are GC root objects referencing Java outer and inner classes?
Powered by Inline Related Posts
Android Tags:android

Post navigation

Previous Post: [FIXED] android – Convert BMP image to PNG or JPG in Java without loading the entire image in memory
Next Post: [FIXED] xml – Android – prevent TextView to push out another element inside LinearLayout

Related Posts

[FIXED] android – How can we send String data to a bluetooth device when App is in foreground? Android
[FIXED] android – FFmpegAndroid library rotates video after Compress Android
[FIXED] javascript – How do I perform conditional rendering in my FlatList RenderItem component correctly? Android
[FIXED] user interface – android-how to partially tint icons of bottomNavigationView? Android
[FIXED] How to use infrared sensor in Android-studio? Android
[FIXED] Change android theme using preference and Configuration Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can VPN be traced by police?
  • Where were Kaiser-Frazer cars built?
  • How do you make gold rose gold paint?
  • What are the newest type of dentures?
  • Can you wear joggers as dress pants?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme