How to set Floating Action Button image to fill the button?

后端 未结 7 1620
情歌与酒
情歌与酒 2021-01-11 17:27

Usually icons are set for floating action buttons, but I need to set an image, so I can make a circular image.

I added it to the project (using Android Studio-> New

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-11 17:36

    1. Override image size dimension for nested image in FAB by adding below line in dimens.xml

    56dp

         (I used 56dp cause fab size in guidelines is 56dp)
    
    1. add app:tint="@null" and android:scaleType="fitCenter" in FAB.

提交回复
热议问题