New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make labels clickable #95
Comments
Great idea, but it's not there simple to implement it in a correct way. You Having said that, this improvement is quite high on my TODO list for this
|
Have the fab and the label view inside a layout set to wrap content. Then have on click calls go to the layout inside of the label? |
The workaround I used was go to setTitle method inside FloatingActionButton and add: label.setOnClickListener(new OnClickListener() Hopes this helps someone. |
@tamiof your solution not worked for me, the performClick() returns to onClickListener of the FloatingActionMenu and not my FloatingActionButton... |
@tamiof I found that making the label clickable involved slightly more than your suggestion above. See my commit wjwarren@10cdcb6 |
I think it's better to use "setOnClickListener" on the label TextView and call "performClick" inside of it, on the "FloatingActionButton" itself. All of this, just when you create the labels TextViews. Here's the relevant part (in "FloatingActionsMenu") :
|
Maybe extend the touchable area of the FAB with a TouchDelegate would be more reliable than the If @chalup agrees with this solution I can make a PR next weekend |
@lynfogeek Well, I offered to make it fully customizable, so that you could put whatever views you wish, and choose what to do on each clicking of which. This way, there won't be any weird workarounds for this case. |
@AndroidDeveloperLB but you should not have a use case where clicking on the label does something else than clicking on the FAB. Helping such behavior via the library is bad design IMO. |
@lynfogeek I didn't say it should or should not. I want to give the control to whoever uses it. This way, the developer that puts the views can also decide how to put them, with which animations, angle, and so on... if he does something weird with the functionality, it's his fault. They don't even have to put labels. Any View can be put instead. |
Which is the state of this issue? |
@danielesegato I don't know, but I've offered a very tiny change that you can do to make it work: |
By making the private TextView getLabelView() {
return (TextView) getTag(R.id.fab_label);
} to public in FloatingActionButton.java and using this with floating action button will solve this problem |
After showing my app to an handful of tester, I realized that most of them wanted to click on the label itself instead of the FloatingActionButton attached to it.
It would be nice to handle it with the FloatingActionButton click/touch listener.
The text was updated successfully, but these errors were encountered: