Reputation: 383
I am trying to wrap my text in a nav-tab It doesn't display everything if the phone isn't horizontal
Here is my xml code fot the nav tab:
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_scan"
android:icon="@drawable/ic_menu_camera"
android:title="@string/nav_option_scannen" />
<item
android:id="@+id/nav_import"
android:icon="@drawable/ic_menu_manage"
android:scrollHorizontally="false"
android:ellipsize="none"
android:title="@string/nav_option_import"
android:visible="true" />
<item
android:id="@+id/nav_export"
android:icon="@drawable/ic_menu_send"
android:scrollHorizontally="false"
android:ellipsize="none"
android:title="@string/nav_option_export" />
<item
android:id="@+id/nav_manage"
android:icon="@drawable/ic_menu_manage"
android:title="Tools"
android:visible="false" />
</group>
and the 2 strings that are not fully displayed
<string name="nav_option_import">Besucherliste importieren</string>
<string name="nav_option_export">Besucherliste exportieren</string>
if I am trying to ad a "\n" in the string it doesn't work as well, furthermore I would like the text to wrap automatically
Upvotes: 5
Views: 1782
Reputation: 309
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:maxWidth="350dp"
Try to use android:maxWidth
attribute. It defaults to 280dp. You can overwrite it to achive a desired width of the drawer.
Upvotes: 1
Reputation: 21
<com.google.android.material.navigation.NavigationView
android:layout_width="match_parent"
use this match parent
Upvotes: 2
Reputation: 8705
I don't think there's an appropriate property to do so, however you can use android:titleCondensed
property to display a shorter title when there's not enough space to display the whole title string. Reference here
Upvotes: 1