Floating Action Button with square shape

丶灬走出姿态 提交于 2019-11-30 21:44:59
poss

Use

app:backgroundTint="@android:color/holo_green_dark"

(for example) to set color of fab. Result below. Taken from this -tested- code snippet.

Also edit : "strange green color" should come from your accent color. That's the color fab takes by default.

Use this code in your xml

app:borderWidth="0dp"

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_add"
    android:layout_marginRight="20dp"
    app:fabSize="normal"
    android:elevation="@dimen/fab_elevation"
    android:background="#000000"
    app:borderWidth="0dp"
    android:stateListAnimator="@animator/fab_anim"
    android:layout_gravity="center_horizontal"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true" />

just add app:borderWidth="0dp"

simply setting app:borderWidth="0dp" resolve the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!