How to adjust this ? I am trying to make a navigation drawer in my app,I managed to add horizontal lines between items, but I want to adjust space between the icon and the title.
Asked
Active
Viewed 4,886 times
2

Marcin Orlowski
- 72,056
- 11
- 123
- 141

Abhishek Sengupta
- 2,938
- 1
- 28
- 35
-
You can Use custom navigation for that like this https://stackoverflow.com/a/51094894/7666442 – AskNilesh Jul 21 '18 at 06:43
-
https://material.io/design/components/navigation-drawer.html#specs – Dracarys Jul 21 '18 at 06:47
-
Try `app:itemIconPadding` – h8pathak Nov 10 '20 at 12:51
3 Answers
0
The best approach is to use a RecyclerView inside NavigationDrawer. You can always customize a recyclerView item (i.e. providing gaps between different elements).

Siddharth Bhatheja
- 376
- 3
- 10
0
another way to implement this,, use navigation bar like this
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
app:headerLayout="@layout/drawer_header"
android:background="#00fdfdfd"
app:itemIconTint="@android:color/white"
app:itemTextColor="@android:color/white">
<LinearLayout
android:animateLayoutChanges="true"
android:layout_marginTop="45dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/pull_navBar"
android:layout_width="35dp"
android:layout_height="match_parent">
<ImageView
android:layout_marginTop="105dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_double_arrow_left"/>
</LinearLayout>
<LinearLayout
android:background="@color/grey"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<TextView
android:textColor="@android:color/holo_blue_light"
android:text="Date"
android:textSize="16dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<TextView
android:textColor="@android:color/holo_blue_light"
android:text="Session Name"
android:layout_weight="1"
android:textSize="16dp"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rec_sessionList"
android:layout_width="match_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.NavigationView>
you can put any root layout inside the navigation and achive any view

ankur uniyal
- 86
- 11
0
Add this code in style.xml
<style name="NavStyle" parent="Base.TextAppearance.AppCompat">
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/candidate_title</item>
<item name="android:padding">0dip</item>
</style>
and set app:itemIconPadding="@dimen/activity_margin_10dp"
app:itemTextAppearance="@style/NavStyle"
in NavigationView

sushant singh
- 696
- 1
- 8
- 18
-
You mean in the Drawer.Navigator params? Where does the 2nd part go? Why is the 1st part also required? – Kevin Apr 21 '20 at 17:31
-
2nd part goes into
1st part is not necessary.It is only for styling ... – sushant singh Apr 22 '20 at 19:15