Clans / FloatingActionButton

Android Floating Action Button based on Material Design specification
Apache License 2.0
5.23k stars 1.13k forks source link

FloatingActionMenu onFinishInflate not called #473

Open pomus opened 4 years ago

pomus commented 4 years ago

If FloatingActionMenu add from source code (not xml), than onFinishInflate not called So mMenuButton OnClickListener not set

https://developer.android.com/reference/android/view/View.html#onFinishInflate()

I suggest that Move OnClickListenerSetter to createMenuButton() method

createMenuButton() { mMenuButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { toggle(mIsAnimated); } }); }

instead of

createLabels { ... if (fab == mMenuButton) { mMenuButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { toggle(mIsAnimated); } }); } ... }