【问题标题】:Customize Navigationview menu UI Android自定义 Navigationview 菜单 UI Android
【发布时间】:2016-09-21 09:23:13
【问题描述】:

我正在使用 android 的 NavigationView 控件来创建滑动抽屉。 一切都很好,除了导航视图中菜单项之间的间距,如图所示。

提前谢谢你们

导航视图

<android.support.design.widget.NavigationView
    android:id="@+id/navigation_view"
    android:layout_height="match_parent"
    android:layout_width="wrap_content"
    android:layout_gravity="start"
    app:headerLayout="@layout/homescreen_header"
    app:menu="@menu/homescreen_nav_drawer"

    app:itemIconTint="@color/green"
    app:itemTextColor="@color/White"
    app:theme="@style/NavigationView"
    app:itemBackground="@color/nav_item_bg"
    android:background="@color/nav_item_bg"
    />

<style name="NavigationView" >
    <item name="android:listDivider">@android:color/black</item>
</style>

【问题讨论】:

  • 请贴一些代码
  • 我想我需要在主题中做点什么。但是缺少准确性
  • @Ironman 我尝试了两种解决方案,但都不起作用
  • @JayVyas 在你的dimen 中添加这个&lt;dimen tools:override="true" name="design_navigation_icon_padding"&gt;0dp&lt;/dimen&gt;

标签: android navigation-drawer android-navigationview


【解决方案1】:

创建样式
   <style name="NavigationViewStyle">
    <item name="android:listPreferredItemHeightSmall">25dp</item><!-- menu item height-->
</style>

并将此样式应用于 NavigationView

 app:theme="@style/NavigationViewStyle"

【讨论】:

    猜你喜欢
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多