Android 浮动操作按钮上的阴影
由于某些原因,我的浮动操作按钮顶部会出现一个小阴影,但仅在调试设备上出现,而在Android Studio预览中则没有 按钮嵌套在相对布局中,以将其放置在屏幕底部,如下所示:Android 浮动操作按钮上的阴影,android,android-studio,Android,Android Studio,由于某些原因,我的浮动操作按钮顶部会出现一个小阴影,但仅在调试设备上出现,而在Android Studio预览中则没有 按钮嵌套在相对布局中,以将其放置在屏幕底部,如下所示: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.c
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_margin="16dp"
android:src="@drawable/baseline_play_circle_outline_white_36" />
</RelativeLayout>
是单击时的外观。
该问题也是由于向FAB-like添加alpha值引起的
但在我的例子中,由于阴影颜色几乎与原始颜色相同,添加0.9 alpha会使其不那么明显。尝试向fab添加以下属性:
android:clipChildren="false"
android:clipToPadding="false"
为了定位晶圆厂,你应该更喜欢协调布局而不是相对布局。当你展示一个小吃条或类似的东西时,它会移动晶圆厂。这似乎不起作用,我已经更新了我的问题