How I can remove the unnecessary top padding of the Navigation view?

前端 未结 5 1802
面向向阳花
面向向阳花 2020-11-28 10:08

There\'s an unnecessary top padding between the header and the first item shown in this picture.

\"enter

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 10:19

    You should read the Ian's answer. The NavigationView follows the Material guidelines and you should not break these specs.

    However, currently, you can override this value in your project.

    Just add to your dimens.xml:

    0dp
    

    Warning:

    • in the future the Android Team can change this value!
    • the same value is applied to each separator in the list

    The NavigationView uses a LinearLayout as header view. You can see this layout in the source code:

    
    

提交回复
热议问题