Skip to content

Instantly share code, notes, and snippets.

@root-ansh
Last active July 1, 2018 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save root-ansh/b3199c2ed3f23e24cd1ad29c91d218d7 to your computer and use it in GitHub Desktop.
Save root-ansh/b3199c2ed3f23e24cd1ad29c91d218d7 to your computer and use it in GitHub Desktop.
CustomizingNavigationDrawer1
<androidx.drawerlayout.widget.DrawerLayout
...
android:layout_height="match_parent"
android:background="@drawable/side_nav_bar" <--- added a picture background background here
android:fitsSystemWindows="true"
tools:openDrawer="start">
...
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
...
android:fitsSystemWindows="false"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="#fff" <---- added white color for the icons here
app:itemTextColor="#fff" <---- added white color for the text here
android:background="@android:color/transparent"
app:menu="@menu/activity_main_drawer" />
....
</>
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
...
drawer.setScrimColor(Color.TRANSPARENT); //cleared the scrim color: scrim is the light shade that appear on our content view while sliding
toggle.syncState();
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment