मैंने आपके द्वारा अभी तक निम्न विधि द्वारा उल्लिखित प्रभाव प्राप्त किया है। मैंने अभी फ़्लोटिंग बटन के पीछे और अन्य लेआउट के ऊपर एक दृश्य जोड़ा है, और दृश्य दृश्यता को तब तक रखा है जब तक कि मेनू का विस्तार नहीं हो जाता। फिर मैंने दृश्य दृश्यता को दृश्यमान पर सेट किया। और हाँ, मैंने दृश्य की पृष्ठभूमि को आपके इच्छित अपारदर्शी रंग पर सेट किया है।
मेरे कोड
मेरे एक्सएमएल फ़ाइल
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Other View here"
android:textSize="50dp"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<View
android:id="@+id/background_dimmer"
android:visibility="gone"
android:background="#55000000"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/multiple_actions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
fab:fab_addButtonColorNormal="@color/white"
fab:fab_addButtonColorPressed="@color/white_pressed"
fab:fab_addButtonPlusIconColor="@color/half_black"
fab:fab_labelStyle="@style/menu_labels_style"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/action_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/white"
fab:fab_title="Action A"
fab:fab_colorPressed="@color/white_pressed"/>
</com.getbase.floatingactionbutton.FloatingActionsMenu>
और गतिविधि या टुकड़ा जहां FloatingButtons
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
setFloatingButtonControls();
}
private void setFloatingButtonControls(){
this.bckgroundDimmer = findViewById(R.id.background_dimmer);
this.floatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.multiple_actions);
this.floatingActionsMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
@Override
public void onMenuExpanded() {
bckgroundDimmer.setVisibility(View.VISIBLE);
}
@Override
public void onMenuCollapsed() {
bckgroundDimmer.setVisibility(View.GONE);
}
});
}
यह नियंत्रित किया जाता है प्रभाव आप चाहते थे दे देंगे पर। उम्मीद है की यह मदद करेगा। यह निश्चित रूप से मेरी मदद की। :)
मैं फ्रैगमेंट में फ़्लोटिंगएक्शनमेनू प्रदर्शित कर रहा हूं और उपरोक्त समाधान का उपयोग करके एक्शन बार ओवरले नहीं करता है। किसी भी विचार को पूर्ण स्क्रीन पर ओवरले कैसे प्राप्त करें? –
@Pawanकुमार आपको फ्रैगमेंट में समस्या का सामना करना पड़ेगा। या तो ओवरले दृश्य खंड के पीछे होगा या सबकुछ पर शीर्ष होगा। एफएबी भी ओवरलैड होगा। गतिविधि में एफएबी का उपयोग करना बेहतर होगा। –