Open Kolyall opened 7 years ago
@Kolyall I also wanted to change menu at runtime. For now its much easier and expressive to create multiple fabs on the xml with your menus and set visibility of the fab at runtime to the one you want to display.
@Henriquedn can you post an example how you change visibility for menu items?
@Kolyall am assuming there is something (data) on your fragment/activity that determines which menu you want to be inflated by the fab. assume data boolean x show menu A when true, show menu B when false.
Create two Fabs fab one with menu A and fab two with menu B
if(x) show fab one if(!x) show fab two
this is just a quick fix not the actual implementation
@Henriquedn There is no any data that determines which menu you want to be inflated by the fab,because inflate is in xml of the FAB for ex:
<io.github.yavski.fabspeeddial.FabSpeedDial
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:fabGravity="bottom_end"
app:fabMenu="@menu/menu_fab"//here is inflate of the menu
/>
Please add a possibility to change menu programmatically, because now it can be set only from layout:
app:fabMenu="@menu/menu_fab"