Problem : NavigationView not show full text of menu item, also not truncate text.
This item I see correctly - two words "Small title":
<item
android:id="@+id/example1"
android:icon="@drawable/filter_2"
android:title="Small title"
android:checked="false"
app:actionLayout="@layout/menu_counter" />
/>
And with next item - I see only first two words "Small title" without any truncate of next word "andveryverylongword":
<item
android:id="@+id/example2"
android:icon="@drawable/filter_2"
android:title="Small title andveryverylongword"
android:checked="false"
app:actionLayout="@layout/menu_counter" />
/>
Widget :
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
ndroid:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"/>
Also : AndroidStudio 1.5, support library.
EDITED : Here is example of standart project "Navigation Drawer Activity" in Android Studio.
activity_main_drawer.xml :
in mobile :
I just got this working
* Override design_navigation_item.xml and change it to use
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeightSmall"
Kinda cool, I can't believe that works. Thanks to the guy on stackoverflow that talked about overriding icon size, which helped me thinking in this direction.
Add app:itemMaxLines="2"
in NavigationView of your layout.
That worked for me.
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
app:itemMaxLines="2"
android:background="@color/background_color"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With