您可以看到橙色圆圈周围的另一个圆角矩形,或者我真的不知道那是什么...但是它在那里。
我怎么藏那东西?
此仅出现在API 19(Android 4.4)
我使用'com.android.support:design:26.0.2'
谢谢。
E D I T:
我不使用海拔。
XML源:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:padding="8dp">
<android.support.design.widget.FloatingActionButton
android:id="@+id/stream_toggle_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_stream_video_white" />
</LinearLayout>
答案 0 :(得分:2)
FAB使用阴影,LinearLayout
不适合使用阴影,因为它包装了视图内容并忽略了fab阴影。
FAB应该位于RelativeLayout
,FrameLayout
(最合适)或CoordinatorLayout
中。作为FAB的父级,视图的主要布局未包装FAB大小。
FAB在其中的基本用法是-
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
app:fabSize="normal"
app:srcCompat="@drawable/ic_add_white_24dp" />