Stack overflow and fabImageResource not working.
See original GitHub issueStep 1: Are you in the right place?
- I have verified there are no duplicate active or recent bugs, questions, or requests
- I have verified that I am using the latest version of the library.
Step 2: Describe your environment
- Library version:
3.2.0
- Android version:
10
- Support library version:
com.google.android.material:material:1.3.0
- Device brand:
OnePlus
- Device model:
7 Pro
(Also tested not working on a Xiaomi device)
Step 3: Describe the problem:
Steps to reproduce:
setContentDescription
onSpeedDialView
- use
new SpeedDialActionItem.Builder()
as before (unchanged) - Run app and it crashes due to stack overflow by
setContentDescription
calling itself too many times - Removing the setContentDescription line works, but the icons on the FAB are missing
Relevant Code:
SpeedDialView speedDialView = findViewById(R.id.speedDial1);
speedDialView.setContentDescription(getString(R.string.menu_fab_description));
speedDialView.addActionItem(
new SpeedDialActionItem
.Builder(R.id.fab_justnow, R.drawable.ic_done_black_24dp)
.setFabBackgroundColor(getResources().getColor(R.color.colorAccent))
.setContentDescription(R.string.menu_justnow)
.setLabel(R.string.menu_justnow)
.create());
java.lang.StackOverflowError: stack size 8192KB
at com.leinardi.android.speeddial.SpeedDialView.setContentDescription(SpeedDialView.java:240)
at com.leinardi.android.speeddial.SpeedDialView.setContentDescription(SpeedDialView.java:242)
at com.leinardi.android.speeddial.SpeedDialView.setContentDescription(SpeedDialView.java:242)
at com.leinardi.android.speeddial.SpeedDialView.setContentDescription(SpeedDialView.java:242)
...
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Help Center - Stack Overflow
Welcome to the Stack Overflow Help Center! If you are unable to find the answer you need here, you can also search for...
Read more >Problems with Stack Overflow website
Recently as I have been doing my dev work on my Mac, I had noticed that the Stack Overflow website stopped working for...
Read more >Introducing the Overflow Offline project
Unlocked Labs would not exist without Stack Overflow.” Many coders would say they rely on Stack Overflow to get work done, but Hicklin's ......
Read more >Stack Overflow - Wikipedia
Stack Overflow is a question and answer website for professional and enthusiast programmers. It is the flagship site of the Stack Exchange Network....
Read more >Stack Overflow NYC Office: Careers, Perks + Culture
Find jobs, benefits and insider info about Stack Overflow, an AdTech, ... Employees engage in a combination of remote and on-site work.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Another workaround: set colorOnSecondary in styles.xml. E.g.
Calling .setFabImageTintColor doesn’t seem to be possible if inflating the menu from a menu.xml.
I have the same problem with fab icons go missing. I’ve tried to reproduce the problem but I can’t. I have implemented the exact same code from my project into the sample app and it just works.
One thing that I notice and for now is a
workaround
, setting an image tint color makes the image appear:.setFabImageTintColor(ContextCompat.getColor(mActivity, R.color.white))
Another thing is that,
SpeedDialView
now responds to system lightning (DarkMode
andLightMode
) and changes it’s behaviour accordingly:-icons are tinted automatically in an unpleasant way so it’s better to ovrride this behaviour with
.setFabImageTintColor(ContextCompat.getColor(mActivity, R.color.white))
-label background changes color automatically . Here we can use
.setLabelBackgroundColor(ContextCompat.getColor(mActivity, R.color.white))
to stop changing color.