我在这里谈论Design Support Library。我想改变一些事情:
我尝试了很多,但我似乎找到了解决这些问题的方法。您可以选择菜单项,但不管怎样,而不是只选择更改背景颜色的项目(使用xml属性itemBackground
),菜单中的所有内容都会获得我在<android.support.design.widget.NavigationView
android:id="@+id/nvView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
app:headerLayout='@layout/nav_header'
app:menu="@menu/drawer_view"
app:itemTextColor="@drawable/drawer_item_text"
app:itemBackground="@drawable/drawer_background_selector"
android:fitsSystemWindows="false"/>
中设置的颜色。
drawer_background_selector
这是<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/black" android:state_pressed="true" />
<item android:drawable="@color/white"/>
</selector>
:
{{1}}
对于第二个问题,我想减少图标和文字之间的距离,但在使用谷歌提供的支持库时我无法找到任何方法。
有什么想法吗?或者我必须使用像MaterialDrawer github库这样的库。问题在于我担心可能会更新设计支持库的未来,但这个库可能不会。
答案 0 :(得分:2)
您可以覆盖尺寸值,甚至覆盖布局文件。 我唯一可能仍然坚持的是subheader padding。
e.g。你可以覆盖
<dimen tools:override="true" name="design_navigation_icon_padding">5dp</dimen>
代码