FloatingActionButton 黑框

FloatingActionButton black box

我在我的项目中将这个 https://github.com/makovkastar/FloatingActionButton 库用于 FloatingActionButtons。

在一些较小的设备上,例如 Acer Liquid Z4(Android 版本 4.2.2,屏幕 480x800)或 Genymotion Galaxy S2 图像(Android 版本 4.1.1,屏幕 480x800) FAB 周围有一个黑框:

我试图缩小范围,从我的主题中删除所有特殊内容,使其看起来像这样:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->

</style>

并把按钮放在最简单的布局中:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:paddingTop="@dimen/activity_vertical_margin"
                android:paddingBottom="@dimen/activity_vertical_margin"
                tools:context="de.immowelt.android.immobiliensuche.ui.FabTestActivity">


    <com.melnykov.fab.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</RelativeLayout>

但盒子还在。另一方面,我试图用一个新项目重新创建效果,但无法做到。

使用 mini 尺寸版本或禁用阴影时,该框消失。

对我的问题有什么想法吗?

PS:我尝试清理项目;)

我正在使用那个库,但后来决定制作自己的库,将其设置为 imageButton 或其他东西的背景。我使用了 textview,因为我只需要一个 +。它在我的应用程序中看起来很不错。

    <?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">


    <!-- Drop Shadow Stack -->

    <item>

        <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >

            <padding android:right="1dp" android:bottom="1dp" />

            <solid android:color="#00262626" />

        </shape>

    </item>

    <item>

        <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >

            <padding android:right="1dp" android:bottom="1dp" />

            <solid android:color="#0D262626" />

        </shape>

    </item>

    <item>

        <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >

            <padding android:right="1dp" android:bottom="1dp" />

            <solid android:color="#26262626" />

        </shape>

    </item>


    <!-- Background -->

    <item>

        <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >

            <solid android:color="#448AFF"/>

        </shape>

    </item>

</layer-list>

问题是 FloatingActionButton class 使用名为 shadow.9.png 的可绘制对象作为阴影。我的可绘制对象中也有一个 shadow.9.png,而库 class 显然选错了(我的)。 重命名我的 drawable 解决了这个问题。