看起来FloatingActionButton在Android 4.0和Lollipop上没有工作以太.正如您在下面的图片中看到的那样,在Android Lollipopo上缺少阴影,在Android 4.1.1上它是正方形:/
有谁遇到过这个问题?
图书馆版本:
compile 'com.android.support:design:22.2.0'
码:
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/abc_ic_clear_mtrl_alpha"/>
Run Code Online (Sandbox Code Playgroud)

我试图通过使用支持设计库来设置fab.
XML代码:
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fab"
android:src="@drawable/ic_add_white_18dp"
app:borderWidth="2dp"
app:fabSize="normal"
android:onClick="submit"
app:rippleColor="@color/colorPrimaryDark">
</android.support.design.widget.FloatingActionButton>
Run Code Online (Sandbox Code Playgroud)
在Nexus 6(棒棒糖)上,加号图标正确渲染.

但是在nexus 4(前棒棒糖)上,加上图标大小正在越过圆圈.

我已经下载并使用了材料图标中的加号(ic_add_white_18dp)
使用的图标尺寸:
mdpi - 18dp
hdpi - 27dp
xdpi - 36dp
xxdpi - 54dp
Run Code Online (Sandbox Code Playgroud)

什么应该是正确的大小用于加号图标.
有没有办法我可以实现浮动按钮在4.0及更高版本的android上工作?
我在google plus上看过它,但我还没有找到任何教程.仅适用于android l预览.谷歌+使用什么来实现它?


我正在使用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" />
Run Code Online (Sandbox Code Playgroud)
我没有在我的Java中为FAB设置任何内容,这就是 …