@@ -35,7 +35,7 @@ In `Build.gradle` of app module, include these dependencies.
3535dependencies {
3636
3737 // Material Navigation View Library
38- implementation 'com.shreyaspatil:MaterialNavigationView:1.0 '
38+ implementation 'com.shreyaspatil:MaterialNavigationView:1.1 '
3939
4040 // Material Design Library
4141 implementation 'com.google.android.material:material:1.0.0'
@@ -91,6 +91,16 @@ As already mentioned, this class is inherited from `NavigationView`. You can use
9191New important flag here is.
9292- ` itemStyle ` - Points to a style of menu item of Navigation drawer. <br >
9393There are currently 2 menu styles are defined as below
94+ - ` default_style ` : This flag sets default design style to menu item of Navigation drawer as you can see below.<br >
95+ <img src =" Images/DefaultStyle.png " height =" 200 " />
96+
97+ Implemented as follows:
98+ ```xml
99+ <com.shreyaspatil.material.navigationview.MaterialNavigationView
100+ ...
101+ app: itemStyle ="default_style"/>
102+ ```
103+
94104 - ` rounded_right ` : This flag sets design to menu item of Navigation drawer as *** Rounded Corners at right*** as you can see below.<br >
95105 <img src =" Images/RoundRightFull.png " height =" 200 " />
96106
@@ -119,6 +129,7 @@ All the programmatic way of implementation of `MaterialNavigationView` is same a
119129Two methods are added in this new class as follows..
120130- *** ` setItemStyle(int itemStyle) ` *** : This method sets the Item Style of Menu in MaterialNavigationView at runtime.
121131 ` itemStyle ` should be one of the following constants :
132+ - ` MaterialNavigationView.ITEM_STYLE_DEFAULT `
122133 - ` MaterialNavigationView.ITEM_STYLE_ROUND_RIGHT `
123134 - ` MaterialNavigationView.ITEM_STYLE_ROUND_RECTANGLE `
124135- *** ` getItemStyle() ` *** : It returns the value of item style of menu.
@@ -138,13 +149,17 @@ class MainActivity : AppCompatActivity() {
138149 }
139150
140151 override fun onOptionsItemSelected (item : MenuItem ): Boolean {
141- val itemStyle = when (item.itemId) {
142- R .id.action_round_rect -> MaterialNavigationView .ITEM_STYLE_ROUND_RECTANGLE
143- R .id.action_round_right -> MaterialNavigationView .ITEM_STYLE_ROUND_RIGHT
144- else -> MaterialNavigationView .ITEM_STYLE_ROUND_RIGHT
152+ when (item.itemId) {
153+ R .id.action_default -> {
154+ navView.setItemStyle(MaterialNavigationView .ITEM_STYLE_DEFAULT )
155+ }
156+ R .id.action_round_rect -> {
157+ navView.setItemStyle(MaterialNavigationView .ITEM_STYLE_ROUND_RECTANGLE )
158+ }
159+ R .id.action_round_right -> {
160+ navView.setItemStyle(MaterialNavigationView .ITEM_STYLE_ROUND_RIGHT )
161+ }
145162 }
146- navView.setItemStyle(itemStyle)
147-
148163 return false
149164 }
150165}
0 commit comments