8

I am using android.support.design.widget.FloatingActionButton from the new Design Support library 22.2.0, in my layout file. It is working fine but it shows a square button below API level 17

API 16

Albin Mathew
  • 411
  • 1
  • 6
  • 13
  • Does that mean new design support library is not useful for FAB button below API 17 ? – Albin Mathew Jun 04 '15 at 05:58
  • possible duplicate of [FAB - square on pre Lollipop and without shadow on Lollipop](http://stackoverflow.com/questions/30538604/fab-square-on-pre-lollipop-and-without-shadow-on-lollipop) – BrentM Jun 04 '15 at 06:13

6 Answers6

24

This is known by Google and will be fix soon in the next version of the Design Support Library, see this issue: FAB Appears as a square on API 16. It should only concern API 16.

The workaround, proposed in the same thread, is to add app:borderWidth="0dp" to your FAB.

Gaëtan
  • 11,912
  • 7
  • 35
  • 45
6

Finally the issue has been fixed in the new release

  compile 'com.android.support:design:22.2.1'

this will solve the square layout issue in API 16. FAB performs well if you place it inside Coordinate Layout. Check out https://code.google.com/p/android/issues/list?can=1&q=label:Version-22.2.1 for issues and fixes in new version.

Albin Mathew
  • 411
  • 1
  • 6
  • 13
2

Released version 22.2.1 This release contains bug fixes related to FAB

https://code.google.com/p/android/issues/detail?id=175067

Change your gradle

compile 'com.android.support:design:22.2.1'

Install support repository revision 16. So you can avoid the workaround [app:borderWidth="0dp"]

Deniz
  • 12,332
  • 10
  • 44
  • 62
1

If it helps, I solved my issue by removing

android:background 

It was a remnant from the previous FAB library I used. The design library's gets the color automatically from colorAccent.

Tevin J
  • 641
  • 2
  • 11
  • 15
1

Add the following attribute to the xml floating button

app:borderWidth="0dp"
Pang
  • 9,564
  • 146
  • 81
  • 122
Saravanan
  • 363
  • 1
  • 14
0

use different library projects which supports floating action button below API level 17 . you can find easily here .plz refer this .

Floating Action Button

Community
  • 1
  • 1
Radhey
  • 2,139
  • 2
  • 24
  • 42