Android 从 FloatingActionbutton 移除边框悬停

标签 android android-layout android-button floating-action-button

current situation

如图所示,我的按钮边框上有一个阴影。有没有办法去除阴影,使按钮的颜色与我的操作栏的颜色相对应。就知道它看起来很丑,因为你可以看到阴影。这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

<TableRow
    android:gravity="end">


    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/logInButton"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:borderWidth="0dp"
        app:backgroundTint="@color/faviconColor"
        app:srcCompat="@drawable/ic_person_black_24dp" />

</TableRow>

</TableLayout>

最佳答案

尝试将 android:elevation="0dp" 设置为您的 float 操作按钮。

尽管如此,为什么还要使用 FloatingActionButton 而不是普通按钮? FloatingActionButtons 是 afaik 不能像这样使用,如果你需要,例如圆形波纹效果,还有更优雅的方法可以做到这一点。

编辑: 如果这不起作用(有时),请改用 app:elevation="0dp"

关于Android 从 FloatingActionbutton 移除边框悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56744268/

相关文章:

android芯片占用额外空间;无法换行

android - 将图标放在 MaterialButton 中的文本顶部

java - LinearLayout 内的 fragment - Android

java - 安卓 : Why occur "NotSerializableException" even if implements "Serialization"?

android - ListView 标题忽略 layout_height

android 布局重量以编程方式

java - 编译代码出错

android - 旋转后平移

java - 在 Sqlite 中使用 where 子句更新查询

Android:形状角半径在平板电脑上不起作用