1

The pressedTranslationZ attribute seems to be available only in xml and cannot be set programmatically. Will creating a custom FloatingActionButton solve this problem? What are the possible alternatives?

Piyush
  • 1,744
  • 1
  • 15
  • 28
  • hope your answer will available here. http://stackoverflow.com/questions/30576450/floatingactionbutton-example-with-support-library – brahmy adigopula Feb 19 '16 at 13:01

1 Answers1

2

If you read in the source code of FloatingActionButton, the pressedTranslationZ is set on the special implementation class, which is a private property, so you will not be able to access it using inheritance.

Your two options are using the XML property, or using Java reflection.

Drawbacks of the second option are that it might break with the updates of the design library, and it is not sure if changing using reflection will surely change the button itself too (it might be a property which is set before drawing and untouched after that).

Daniel Zolnai
  • 16,487
  • 7
  • 59
  • 71