Android,FAB使用android支持设计在API21以下的正方形

Android, FAB using android support design is square in API below 21

我正在使用 android support design library,在 API-21 上一切看起来都不错,但在 API-16 上却不行! FAB (Floating action button) 是方形的! 这是我的布局代码:

<android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res/com.example.recycleviewtest"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#6fff"
android:fitsSystemWindows="true" >

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <android.support.v7.widget.RecyclerView
                android:id="@+id/rv"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="50dp" />

            <android.support.design.widget.TextInputLayout
                android:id="@+id/textInputLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <EditText
                    android:id="@+id/editName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Enter your name:"
                    android:singleLine="true" />
            </android.support.design.widget.TextInputLayout>
        </RelativeLayout>
    </LinearLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/floatingActionButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right|bottom"
        android:layout_margin="30dp"
        android:src="@android:drawable/ic_input_add" />
</android.support.design.widget.CoordinatorLayout>

<android.support.design.widget.NavigationView
    android:layout_width="300dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:headerLayout="@layout/navigation_header"
    app:itemBackground="@drawable/abc_list_pressed_holo_light"
    app:itemTextColor="@color/abc_primary_text_material_light"
    app:menu="@menu/main" />

我没有在 java 中为 FAB 和 This is 结果设置任何内容!

我的测试设备是 Samsung galaxy note 10.1android 4.1.2 (API-16)

这是当前支持设计 v22.2.0 库中的一个bug

在问题修复之前,尝试将 app:borderWidth="0dp" 添加到您的 FAB 作为解决方法:

<android.support.design.widget.FloatingActionButton
    ...
    app:borderWidth="0dp" />