第一步:
添加依赖:
implementation 'com.google.android.material:material:1.0.0'
第二步:
xml文件中这样写就可以了
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:src="@mipmap/add"
android:backgroundTint="@color/top"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
参考:
https://stackoverflow.com/questions/30576450/floatingactionbutton-example-with-support-library