Italic TextView with wrap_contents seems to clip the text at right edge

前端 未结 13 1371
孤独总比滥情好
孤独总比滥情好 2020-12-24 10:22


        
13条回答
  •  情书的邮戳
    2020-12-24 11:08

    Looking at the source I found out that setting a shadow extends the clip rectangle.

    A trick is to set an invisible shadow just beyond the character.

    For example:

    android:shadowRadius="2"
    android:shadowDx="2"
    android:shadowColor="#00000000"
    

    I think this solution is better as it will not extend the width of the TextView which may happen when adding an extra character (which is more apparent with a background).

提交回复
热议问题