android - Set the distance between the menu in a navigation drawer and the screen edge? -
i want set distance "d" specific value, how can make it?
yes, question how programatically set margin between icon , title of menu item of navigation drawer in android? same mine. code follows:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <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/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start"> <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.navigationview android:id="@+id/nav_view_main" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:fitssystemwindows="false" app:headerlayout="@layout/nav_header" app:menu="@menu/activity_main_drawer" /> </android.support.v4.widget.drawerlayout>
activity_main_drawer.xml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <group android:checkablebehavior="single"> <item android:id="@+id/nav_product" android:icon="@drawable/ic_product" android:title="products" /> <item android:id="@+id/nav_statistic" android:icon="@drawable/ic_statistic" android:title="statistic" /> <item android:id="@+id/nav_settings" android:icon="@drawable/ic_settings" android:title="settings" /> <item android:id="@+id/nav_logout" android:icon="@drawable/ic_logout" android:title="log out" /> </group> <item android:title="communicate"> <menu> <item android:id="@+id/nav_share" android:icon="@drawable/ic_menu_share" android:title="share" /> <item android:id="@+id/nav_send" android:icon="@drawable/ic_menu_send" android:title="send" /> </menu> </item> </menu>
Comments
Post a Comment