我正在使用com.getbase.floatingactionbutton.FloatingActionsMenu展開FAB。但無法在fab菜單上設置圖標。我已經嘗試設置背景可繪製,但沒有工作。 感謝如何將圖標設置爲getbase FloatingActionsMenu
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white_overlay">
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/fab_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
fab:fab_addButtonColorNormal="#C0007D"
fab:fab_addButtonColorPressed="#C0007D"
fab:fab_addButtonStrokeVisible="true"
fab:fab_addButtonSize="normal"
fab:fab_icon="@drawable/main_logo"
fab:fab_labelStyle="@style/menu_labels_style"
fab:fab_labelsPosition="left">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/locate_store"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="#C0007D"
fab:fab_colorPressed="#C0007D"
fab:fab_icon="@drawable/locate_store"
fab:fab_size="mini"
fab:fab_title="Locate Store" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
</FrameLayout>
這裏是我的Java類代碼,
final FloatingActionsMenu fabMenu = (FloatingActionsMenu) v.findViewById(R.id.fab_menu);
fabMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
@Override
public void onMenuExpanded() {
frameLayout.getBackground().setAlpha(240);
frameLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
fabMenu.collapse();
return true;
}
});
}
@Override
public void onMenuCollapsed() {
frameLayout.getBackground().setAlpha(0);
frameLayout.setOnTouchListener(null);
}
});
我有同樣的問題。 :( – Thanos
也許這會有所幫助,這不是我正在尋找的答案,但也許這就是你正在尋找的。http://www.rishabhsinghal.in/implement-floating-action-button-similar-to-inbox by-gmail-by-evernote/ – Thanos
@Thanos我想用一個新圖標替換加號 –