我使用this library这是非常可怕的实现浮动动作按钮与自定义菜单和许多其他的东西。FloatingActionButton不会改变颜色
虽然使用这个库,但我在改变FloatingActionMenu
内FloatingActionButton
的颜色时遇到问题。我尝试将fab:manu_colorNormal
作为FloatingActionButton
的属性,但它似乎没有效果并显示默认颜色。
这是我使用的布局。请注意,我使用xmlns:fab="http://schemas.android.com/apk/res-auto"
。建议在某处检查xmlns:fab
是否指向apk/res-auto
。我确定了这一点,但没有运气。
<?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"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background">
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/fab_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
fab:menu_colorNormal="@color/fab_close_background"
fab:menu_colorPressed="@color/fab_close_background_pressed"
fab:menu_colorRipple="@color/fab_close_background_ripple">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/menu_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_delete_white_24dp"
fab:fab_size="mini"
fab:menu_colorNormal="@color/fab_delete_background"
fab:menu_colorPressed="@color/fab_delete_background_pressed"
fab:menu_colorRipple="@color/fab_delete_background_ripple" />
</com.github.clans.fab.FloatingActionMenu>
</RelativeLayout>
注:我能成功改变FloatingActionMenu
按钮的颜色。 menu_colorNormal
完美适用于我的布局中的关闭按钮。
下面是它在我的应用程序中的外观。红色是我试图改变的默认颜色。问题是reported here in Github。
不工作。请自己尝试。 :) –
尝试更新回答 – USKMobility
非常感谢。它的工作现在。 :) –