Last active
July 1, 2018 18:54
-
-
Save root-ansh/b3199c2ed3f23e24cd1ad29c91d218d7 to your computer and use it in GitHub Desktop.
CustomizingNavigationDrawer1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" /> | |
.... | |
</> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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