Open akshay-shah opened 8 years ago
i did this to solve that problem (which is annoying!): after adding the fabButton with addMenuButton, i've set the tags, on both button and label, like so: listFab.addMenuButton(b); b.setTag(o.getString("id")); View label = (View) b.getTag(R.id.fab_label); if(label != null) label.setTag(o.getString("id")); hope that helps, cheers
You can also work around this problem by calling addMenuButton(fab)
BEFORE calling setOnClickListener
i add fab buttons like this
floatingMenuSort.setVisibility(View.VISIBLE); for (int i = 0; i < sort_options_title.size(); i++) { FloatingActionButton fab = new FloatingActionButton(CategoryListActivity.this); fab.setButtonSize(FloatingActionButton.SIZE_MINI); fab.setLabelText(sort_options_title.get(i)); fab.setColorNormal(Color.parseColor("#00aeef")); fab.setColorPressed(Color.parseColor("#00aeef")); fab.setColorRipple(Color.parseColor("#00aeef")); fab.setTag(sort_option_value.get(i)); fab.setOnClickListener(CategoryListActivity.this); switch (sort_option_value.get(i)) { case "pops": fab.setImageResource(R.drawable.popular); break; case "priceltoh": fab.setImageResource(R.drawable.sortasce); break; case "pricehtol": fab.setImageResource(R.drawable.sortdesc); break; case "discount": fab.setImageResource(R.drawable.percent); break; } floatingMenuSort.addMenuButton(fab); }
so in onclick i recieve an instance of label when label is clicked whereas i should recieve instance of fab button