Open GregoryIwanek opened 7 years ago
Of course they can. You are using the correct method to do this. Not sure what your code line is but here is an example that I just tested and its working: fab.setLabelTextColor(Color.BLACK);
I personally dont change the label color but I tested this during onCreateView of my fragment where I programmatically set the button size and image.
Great it's working.
Color labeñ
app:menu_labels_textColor="#FFB098"
change fab for app prefix in xml schema
Hi. I have floating action menu with couple of floating action buttons and labels. When I initiate module with menu I need to set colors to some labels ( which button, differes between occurs of module initiation, so it can't be hardcoded).
Is there any possibility to set FAB's label text color programmatically on Java side? Fab button has method
fab.setLabelTextColor(int color)
, but trying to call this results injava.lang.NullPointerException: Attempt to invoke virtual method 'void com.github.clans.fab.Label.setTextColor(int)' on a null object reference at com.github.clans.fab.FloatingActionButton.setLabelTextColor(FloatingActionButton.java:1314)
I could iterate through all views inside fab menu and with method "xxx instanceof Label" get access to Label views, and modify them directly but it's unefficient; Can floating button color parameters be set from java code? Or only in xml?
Thanks in advance.