DQu*_*ade 3 title menuitem android-support-library navigationview
问题:NavigationView 不显示菜单项的全文,也不截断文本.
我正确看到这个项目 - 两个字" 小标题 ":
<item
android:id="@+id/example1"
android:icon="@drawable/filter_2"
android:title="Small title"
android:checked="false"
app:actionLayout="@layout/menu_counter" />
/>
Run Code Online (Sandbox Code Playgroud)
而对于下一个项目 - 我只看到前两个单词" 小标题 ",没有任何截断下一个单词" andveryverylongword ":
<item
android:id="@+id/example2"
android:icon="@drawable/filter_2"
android:title="Small title andveryverylongword"
android:checked="false"
app:actionLayout="@layout/menu_counter" />
/>
Run Code Online (Sandbox Code Playgroud)
小工具:
<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"/>
Run Code Online (Sandbox Code Playgroud)
另外:AndroidStudio 1.5,支持库.
编辑: 以下是Android Studio中标准项目"导航抽屉活动"的示例.
我刚刚开始工作*覆盖design_navigation_item.xml并将其更改为使用
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeightSmall"
有点酷,我不敢相信有效.感谢stackoverflow上讨论覆盖图标大小的人,这有助于我思考这个方向.
添加app:itemMaxLines="2"到布局的 NavigationView 中。这对我有用。
<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" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1572 次 |
| 最近记录: |