FAB - square on pre Lollipop and without shadow on Lollipop

情到浓时终转凉″ 提交于 2019-11-27 20:31:53

Thanks to @harism comment, simply setting app:borderWidth="0dp" resolve both issues.

Note: don't forget to add xmlns:app="http://schemas.android.com/apk/res-auto" to your root layout.

If the FAB still appears as square after setting borderWidth to 0dp, make sure that you aren't setting android:background in your XML or calling setBackgroundColor in code.

You should use android:backgroundTint (XML) or setSupportBackgroundTintList (code)

@Raghunandan, I have same problem on Lollipop also.
Finally I find that the root cause is a drawable named "fab_background" in my drawable folder.
The drawable is previously used for my own fab implementation.
Now I can see round fab after I rename this drawable.

Setting app:borderWidth="0dp" works. But if you are getting rendering issues in Android studio and have the Renderer set to Android M or 22, set it to 21

Seems to be a bug. A developer said "Fixed internally. Will be out soon.".

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