Android NavigationView with internal spacing -


i developing android app support navigationview. have question make want it: (1) want divide navigation elements 2 areas: 1 @ top below header , 1 @ bottom end. (2) want remove padding between divider , element below it.

how looks vs how should look: how looks vs how should look

i know there way override padding value, fix (2). feels kind of dirty , maybe there approach achieve both of this. idea "settings"-element , change layout programmatically, far didn't find way working. or have build footer myself?

also, not quite sure buzzwords should googling. maybe there easy answer out there.

my current code. right there no layout changes inside activity, therefore did not add it.

activity_main.xml:

<android.support.v4.widget.drawerlayout  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/main_drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true"     tools:context=".main.mainactivity">      <!-- content -->     <linearlayout>...</linearlayout>      <!-- navigation drawer -->     <android.support.design.widget.navigationview         android:id="@+id/main_navigationview"         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:layout_gravity="start"         android:background="@android:color/white"         app:headerlayout="@layout/mainnav_header"         app:itembackground="@drawable/menu_background"         app:itemicontint="@color/menu_text"         app:itemtextcolor="@color/menu_text"         app:menu="@menu/maindrawer">      </android.support.design.widget.navigationview>  </android.support.v4.widget.drawerlayout> 

menu.xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">  <group android:id="@+id/main_drawer_menu1" android:checkablebehavior="single">     <item         android:id="@+id/main_navigationview_request"         android:checkable="false"         android:enabled="false"         android:icon="@drawable/ic_navigationdrawer_request"         android:title="@string/main_navigation_request"         app:actionlayout="@layout/menuitem_default" />     <item         android:id="@+id/main_navigationview_invitations"         android:checked="true"         android:icon="@drawable/ic_navigationdrawer_invitations"         android:title="@string/main_navigation_invitations"         app:actionlayout="@layout/menuitem_default" />     <item         android:id="@+id/main_navigationview_prev"         android:icon="@drawable/ic_navigationdrawer_previous"         android:title="@string/main_navigation_previnvites"         app:actionlayout="@layout/menuitem_default" />     <item         android:id="@+id/main_navigationview_info"         android:icon="@drawable/ic_navigationdrawer_info"         android:title="@string/main_navigation_info"         app:actionlayout="@layout/menuitem_default" /> </group> <group android:id="@+id/main_drawer_menu2" android:checkablebehavior="single">     <item         android:id="@+id/main_navigationview_settings"         android:checked="true"         android:icon="@drawable/ic_navigationdrawer_settings"         android:title="@string/main_navigation_settings"         app:actionlayout="@layout/menuitem_default" />     <item         android:id="@+id/main_navigationview_logout"         android:icon="@drawable/ic_navigationdrawer_logout"         android:title="@string/main_navigation_logout"          app:actionlayout="@layout/menuitem_caution" /> </group> 

this line remove padding between icon , text.

only add below line in dimen.xml file

<dimen tools:override="true" name="design_navigation_icon_padding">10dp</dimen> 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -