android:drawableLeft margin and/or padding

后端 未结 18 2218
猫巷女王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:14

    As cephus mentioned android:drawablePadding will only force padding between the text and the drawable if the button is small enough.

    When laying out larger buttons you can use android:drawablePadding in conjunction with android:paddingLeft and android:paddingRight to force the text and drawable inward towards the center of the button. By adjusting the left and right padding separately you can make very detailed adjustments to the layout.

    Here's an example button that uses padding to push the text and icon closer together than they would be by default:

提交回复
热议问题