Open Jaldip-Hexa opened 5 years ago
Have same issue , solved by sort menu and content FrameLayout , menu must be the first like this.
`<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="menu"/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="content"/>`
@Abdullah-Hussein it doesn't work i still have the same issue and this is my code <nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer" android:layout_width="match_parent" android:layout_height="match_parent">
<nl.psdcompany.duonavigationdrawer.views.DuoMenuView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:tag="@string/tag_menu"
app:header="@layout/duo_view_header"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="@string/tag_content">
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar_main"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<FrameLayout
android:id="@+id/main_fragment_container"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/main_bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/main_toolbar" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/main_bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:itemIconTint="@drawable/bottom_navigation_selector"
app:itemTextColor="@drawable/bottom_navigation_selector"
android:elevation="@dimen/spacing_tiny"
app:menu="@menu/main_bottom_navigation_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
@SWE2017 after you set menu layout, using this mViewHolder.mDuoDrawerLayout.getMenuView().setAlpha(0);
you can play with visibility like nav_header_home.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:id="@+id/nav" android:visibility="gone" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:theme="@style/ThemeOverlay.AppCompat.Dark" android:orientation="vertical" android:gravity="top"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dp" android:layout_marginStart="20dp"
android:layout_marginLeft="20dp">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/sum"
android:id="@+id/imageView"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="rashed ahmed "
android:id="@+id/name"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="rased@gmal.com"
android:id="@+id/gmail"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="30dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:id="@+id/home"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="userArtists"
android:id="@+id/userArtists"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Support"
android:id="@+id/support"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Share app"
android:id="@+id/share"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
/>
</LinearLayout>
home.layout
<nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/side_nav_bar" app:menu="@layout/nav_header_home"
val drawerToggle = object :DuoDrawerToggle(this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close){ override fun onDrawerOpened(drawerView: View) { super.onDrawerOpened(drawerView) nav.visibility=View.VISIBLE
}
override fun onDrawerClosed(drawerView: View) {
super.onDrawerClosed(drawerView)
nav.visibility=View.GONE
}
}
### How i change background color of duo navigation menu.
<nl.psdcompany.duonavigationdrawer.views.DuoMenuView android:tag="menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_marginTop="30dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_postcode_24"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textStyle="bold"
android:textColor="@color/white"
android:textSize="25sp"
android:text="Omninos Solutions"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Myorder"
android:gravity="center_vertical"
android:layout_marginTop="50dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_myorder_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="My Orders"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Cart"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_cart_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Cart"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Wallet"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_wallet_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Wallet"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_LiveTracking"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_postcode_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Live TRacking"
android:textAllCaps="true"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Chat"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_chat_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="chat"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_TermsConditions"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_chat_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Term & conditions"
android:textAllCaps="true"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Help"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_chat_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Help"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_PaymentHistory"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_chat_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Payment hystory"
android:textAllCaps="true"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Logout"
android:gravity="center_vertical"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="24dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_baseline_logout_24"
app:tint="@color/white" />
<TextView
android:textSize="16sp"
android:layout_marginHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Logout"
android:textColor="@color/white"/>
</LinearLayout>
</LinearLayout>
</nl.psdcompany.duonavigationdrawer.views.DuoMenuView>
In My Application, Current Activity does not have background, Whole window has a background, Like, Window window = activity.getWindow(); Drawable background = ContextCompat.getDrawable(activity, R.drawable.background_login_screen); window.setBackgroundDrawable(background);
Because of this left menu is overlapping with activity UI, One time opening and closing the Drawer solves the problem, But by default it Overlaps, Please provide solution how to keep menu in hidden state by default?