android:drawableLeft margin and/or padding

后端 未结 18 2274
猫巷女王i
猫巷女王i 2020-11-27 09:29

Is it possible to set the margin or padding for the image which we added with the android:drawableLeft?

18条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 10:01

    TextView has an android:drawablePadding property which should do the trick:

    android:drawablePadding

    The padding between the drawables and the text.

    Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

    This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

    This corresponds to the global attribute resource symbol drawablePadding.

提交回复
热议问题