chturing184
V2EX  ›  Android

吐槽一下 Android TextView 一个很坑的问题: drawableRight 不能和文字一起居中

  •  
  •   chturing184 · Apr 7, 2016 · 16036 views
    This topic created in 3871 days ago, the information mentioned may be changed or developed.

    当 TextView 长宽较大时,想让 drawableRight 和文字一起居中显示,但是 android:gravity="center"对 drawableRight 不起作用!

    2 replies  •  2016-04-08 09:54:29 +08:00
    nekocode
    nekocode
    Apr 7, 2016❤️1
    1
    drawableRight 本身就是在被设计为在 TextView 内容最右边显示的。要和文字一起居中的话请在文字中设置 ImageSpan 。
    chturing184
    chturing184
    OP
    Apr 8, 2016
    2
    @nekocode 嗯,博客园有一个自定义的 TextView , drawable 可以和文字一起居中,但是有点 bug
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4232 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 09:19 · PVG 17:19 · LAX 01:19 · JFK 04:19
    ♥ Do have faith in what you're doing.