项目菜单标题长于 DrawerLayout
Item menu title longer than DrawerLayout
我想做这个
如果item标题比DrawerLayout长,在item的最后写三点!
[
更新
我通过这个答案解决了这个问题
添加带有 ellipsize 的样式并将其设置为 NavigationView 的主题。
<style name="TextAppearance">
<item name="android:ellipsize">end</item>
</style>
在你的xml
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android: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"
app:theme="@style/TextAppearance" />
我建议跑马灯效果,我觉得你的cas我觉得你需要显示所有的文字
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="This is a test of marquee on the text view in android."
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
/>
我想做这个 如果item标题比DrawerLayout长,在item的最后写三点!
[
添加带有 ellipsize 的样式并将其设置为 NavigationView 的主题。
<style name="TextAppearance">
<item name="android:ellipsize">end</item>
</style>
在你的xml
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android: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"
app:theme="@style/TextAppearance" />
我建议跑马灯效果,我觉得你的cas我觉得你需要显示所有的文字
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="This is a test of marquee on the text view in android."
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
/>