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:18

    If the size of drawable resouce is fixed, you can do like this:

    The key here is that:

        android:drawableRight="@drawable/ic_clear_black_24dp"
        android:paddingRight="10dp"
        android:paddingLeft="34dp"
    

    That is, the size of drawable resource plus paddingRight is the paddingLeft.

    You can see the result in this example

提交回复
热议问题